Execute Deploy Cluster Pre Operation
@param options
@param cb
@returns {*}
187101
function (options, cb) {
		
		options.soajs.log.debug("Generating docker token");
		crypto.randomBytes(1024, function (err, buffer) {
			if (err) {
				return cb(err);
			}
			options.soajs.registry.deployer.container.docker.remote.apiProtocol = 'https';
			options.soajs.registry.deployer.container.docker.remote.apiPort = 32376;
			options.soajs.registry.deployer.container.docker.remote.auth = {
				token: buffer.toString('hex')
			};
			return cb(null, true);
		});
	}
182239
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        $releaseIdentifier = $deployment->getReleaseIdentifier();
        $releasesPath = $application->getReleasesPath();
        $commands = [
            "mkdir -p $releasesPath/$releaseIdentifier/Data",
            "cd $releasesPath/$releaseIdentifier",
            'ln -sf ../../../shared/Data/Logs ./Data/Logs',
            'ln -sf ../../../shared/Data/Persistent ./Data/Persistent'
        ];
        $this->shell->executeOrSimulate($commands, $node, $deployment);
    }
606527
function bash(pattern, options, cb) {
  if (!isGlob(pattern)) {
    return nonGlob(pattern, options, cb);
  }

  if (typeof options === 'function') {
    cb = options;
    options = undefined;
  }

  var opts = extend({cwd: process.cwd()}, options);

  fs.stat(opts.cwd, function(err, stat) {
    if (err) {
      cb(handleError(err, pattern, opts));
      return;
    }

    if (!stat.isDirectory()) {
      cb(new Error('cwd is not a directory: ' + opts.cwd));
      return;
    }

    var cp = spawn(bashPath, cmd(pattern, options), options);
    var buf = new Buffer(0);

    cp.stdout.on('data', function(data) {
      emitMatches(data.toString(), pattern, options);
      buf = Buffer.concat([buf, data]);
    });

    cp.stderr.on('data', function(data) {
      cb(handleError(data.toString(), pattern, options));
    });

    cp.on('close', function(code) {
      cb(code, getFiles(buf.toString(), pattern, options));
    });
  });
}
1158754
function (project_id, copy_options, cb) {

            _util.buildQuery('projects/' + project_id + '/copy', copy_options, function (error, data) {

                return cb(error, data);

            });

        }
177139
function run(options, ast, cb) {
  var report = new Report(options, ast);
  report.run(cb);
}
96059
function execOptionBuilder(options) {
  var validKeys = {
    cwd:        true,
    env:        true,
    encoding:   true,
    shell:      true,
    timeout:    true,
    maxBuffer:  true,
    killSignal: true,
    uid:        true,
    gid:        true
  };

  options = options || {};

  return Object.keys(options).reduce(function(result, key) {
    if(validKeys[key]) {
      result[key] = options[key];
    }
    return result;
  }, {});
}
462064
function (options, cb) {
		options.soajs.log.debug("Checking if Cluster is healthy ...");
		let stack = options.infra.stack;

		let containerOptions = Object.assign({}, options);
        containerOptions.technology = (containerOptions && containerOptions.params && containerOptions.params.technology) ? containerOptions.params.technology : defaultDriver;

		//get the environment record
		if (options.soajs.registry.deployer.container[stack.technology].remote.nodes && options.soajs.registry.deployer.container[stack.technology].remote.nodes !== '') {
			let machineIp = options.soajs.registry.deployer.container[stack.technology].remote.nodes;
			return cb(null, machineIp);
		}
		else {
			let out = false;
			async.series({
				"pre": (mCb) => {
					runCorrespondingDriver('getDeployClusterStatusPre', containerOptions, mCb);
				},
				"exec": (mCb) => {
					ClusterDriver.getDeployClusterStatus(options, (error, response) => {
						if (response) {
							out = response;
							containerOptions.out = out;
						}
						return mCb(error, response);
					});
				},
				"post": (mCb) => {
					if (out) {
						runCorrespondingDriver('getDeployClusterStatusPost', containerOptions, mCb);
					}
					else {
						return mCb();
					}
				}
			}, (error) => {
				return cb(error, out);
			});
		}
	}
818623
function (cb) {
			if (!o1.options.useCDN)
				return cb();

			o1._log('CDN enabling the container');

			container.enableCdn(function (err, _container) {
				if (err)
					return cb(err);

				// check that a parallel operation didn't just CDN enable the same container
				var index = _.findIndex(o1.aContainers, { name : sName });

				container = o1.aContainers[index] = _container;

				cb();
			});
		}
256783
function runPrompt (opts, cb) {
  prompt([
    {
      name: 'name',
      message: 'Package name',
      default: opts.packageName || ''
    },
    {
      name: 'description',
      message: 'Module description'
    },
    {
      name: 'tags',
      message: 'Module tags'
    }
  ], cb)
}
279077
public Vertigo deployCluster(String cluster, int nodes) {
    return deployCluster(cluster, null, nodes, null);
  }
110793
function applyProxy(options, cb) {
  npmconf.load({}, function (er, conf) {
    var proxyUrl;

    if (!er) {
      proxyUrl = conf.get('https-proxy') ||
                 conf.get('proxy') ||
                 conf.get('http-proxy');
    }

    var env = process.env;

    options.proxy = proxyUrl ||
                    env.HTTPS_PROXY ||
                    env.https_proxy ||
                    env.HTTP_PROXY ||
                    env.http_proxy;

    cb(options);
  });
}
1353346
function (options, cb) {
		let outIP = options.out;
		let stack = options.infra.stack;
		
		if (outIP && stack.options.ElbName) {
			options.soajs.log.debug("Creating SOAJS network.");
			
			dockerUtils.getDeployer(options, (error, deployer) => {
				if(error){
					return cb(error);
				}
				
				deployer.listNetworks({}, (err, networks) => {
					if (err) {
						return cb(err);
					}
					
					let found = false;
					networks.forEach((oneNetwork) => {
						if (oneNetwork.Name === 'soajsnet') {
							found = true;
						}
					});
					
					if(found){
						return cb(null, true);
					}
					else{
						let networkParams = {
							Name: 'soajsnet',
							Driver: 'overlay',
							Internal: false,
							Attachable: true,
							CheckDuplicate: true,
							EnableIPv6: false,
							IPAM: {
								Driver: 'default'
							}
						};
						
						deployer.createNetwork(networkParams, (err) => {
							return cb(err, true);
						});
					}
				});
			});
		}
		else {
			return cb(null, false);
		}
	}
365939
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        try {
            $options = $this->configureOptions($options);
        } catch (ExceptionInterface $e) {
            return;
        }

        if (empty($options['directories'])) {
            return;
        }

        $baseDirectory = $options['baseDirectory'] ?: $deployment->getApplicationReleasePath($application);

        $commands = array_map(function ($directory) {
            return sprintf('mkdir -p %s', $directory);
        }, $options['directories']);

        array_unshift($commands, sprintf('cd %s', $baseDirectory));

        $this->shell->executeOrSimulate($commands, $node, $deployment);
    }
1265679
function load(opts, cb) {
  if(typeof opts === 'function') {
    cb = opts;
    opts = null;
  }

  var args = opts && opts.args ? opts.args : null
    , defaults = path.normalize(path.join(__dirname, 'command'));
  opts = opts || argv(args);

  if(opts.commands === undefined) {
    opts.commands = [defaults];
  }else if(Array.isArray(opts.commands) && opts.defaults) {
    opts.commands.unshift(defaults);
  }

  function onConfigError(err) {
    //console.dir(err);
    console.error(err.message);
    if(process.env.NODE_ENV !== Constants.TEST) {
      process.exit(1);
    }
  }

  this.conf.once('error', onConfigError.bind(this));

  function onConfigLoad() {
    // if we loaded ok we are done with fatal config errors
    // config set/rewrite need to catch errors now
    this.conf.removeAllListeners('error');

    this.emit('config', this.conf);

    opts.conf = this.conf;

    // spawning the daemon process
    if(this.conf.get(ConfigKey.DAEMONIZE) && !this._daemonized) {
      var pid = daemon(
        path.join(__dirname, 'daemonize.js'), this.conf, opts.args);
      if(cb) cb(pid);
      return;
    }

    this.log.notice('cwd: %s', process.cwd());

    // pass configured timeout to script manager
    ScriptManager.timeout = this.conf.get(ConfigKey.LUA_TIME_LIMIT);

    // spawn now, makes first script executions faster
    // later this should be configurable - allow disabling all
    // scripting
    ScriptManager.spawn();

    // load commands
    return loader(opts, onCommandLoad);
  }

  function onCommandLoad(err, commands) {
    if(err) return cb(err);
    this.execs = commands;
    this.emit('ready', this.execs);

    // inject command list so the script manager
    // can detect write commands
    ScriptManager.commands = commands;

    // loading from rdb files breaks the tests
    if(process.env.NODE_ENV === Constants.TEST) {
      return cb();
    }
    Persistence.load(this.state.store, this.state.conf, onDatabaseLoad);
  }

  function onDatabaseLoad(err, time, diff, version) {
    // load errors are thrown, will cause
    // the process to exit
    if(err) throw err;
    if(err !== false) {
      this.log.notice('db loaded from disk: %s seconds (v%s)', time, version);
      this.emit('database', time, diff, version);
    }
    cb();
  }

  onConfigLoad = onConfigLoad.bind(this);
  onCommandLoad = onCommandLoad.bind(this);
  onDatabaseLoad = onDatabaseLoad.bind(this);

  // load config
  this.conf.load(opts, onConfigLoad);
}
916722
function (db, options, cb) {
	this.db = db;
	this.cb = cb;
	this.updateQueryMaker = options.update;
	this.insertQueryMaker = options.insert;
	this.maxUpdateAttemptsCount = options.maxUpdateAttemptsCount || 2;
	this.transform = options.transform;
	this.insertFirst = !!options.insertFirst;
	this.nonQuery = !!options.nonQuery;

	var self = this;
	this.updateAttemptsCount = 0;
	this.updateOrInsertBound = function () {
		self.updateOrInsert();
	};
}
619542
protected function executeCliCommand(array $cliArguments, Node $node, CMS $application, Deployment $deployment, array $options = [])
    {
        $this->determineWorkingDirectoryAndTargetNode($node, $application, $deployment, $options);
        $phpBinaryPathAndFilename = isset($options['phpBinaryPathAndFilename']) ? $options['phpBinaryPathAndFilename'] : 'php';
        $commandPrefix = '';
        if (isset($options['context'])) {
            $commandPrefix = 'TYPO3_CONTEXT=' . escapeshellarg($options['context']) . ' ';
        }
        $commandPrefix .= $phpBinaryPathAndFilename . ' ';

        $this->determineWorkingDirectoryAndTargetNode($node, $application, $deployment, $options);

        return $this->shell->executeOrSimulate([
            'cd ' . escapeshellarg($this->workingDirectory),
            $commandPrefix . implode(' ', array_map('escapeshellarg', $cliArguments))
        ], $this->targetNode, $deployment);
    }
1209006
function exec (opts, cb) {
    var file, ctx;
    if (typeof opts === 'string') {
        file = opts;
        ctx = null;
        opts = {};
    } else {
        ctx = opts.ctx || null;
        file = opts.file;
    }

    // caching
    var ctxHash = ctx ? md5(ctx) : '';
    if (!opts.force && exec.cache[file] && exec.cache[file][ctxHash]) {
        process.nextTick(function () {
            cb(null, exec.cache[file][ctxHash]);
        });
        return;
    }

    load({file: file, force: opts.forceLoad}, function (err, content) {
        if (err) {
            cb(err);
            return;
        }

        var module = _assign({
            Vow     : VOW,
            console : console,
            require : require
        }, ctx);

        try {
            VM.runInNewContext(content, module, file + '.vm');
        } catch (e) {
            cb(e);
            return;
        }

        // caching
        exec.cache[file] = exec.cache[file] || {};
        exec.cache[file][ctxHash] = module;

        cb(null, module);
    });
}