Verify the Baremetal nodes are available and do a stack update
5398
def _heat_deploy(self, stack, stack_name, template_path, parameters,
                     environments, timeout):
        """"""

        self.log.debug("Processing environment files")
        env_files, env = (
            template_utils.process_multiple_environments_and_files(
                environments))

        self.log.debug("Getting template contents")
        template_files, template = template_utils.get_template_contents(
            template_path)

        files = dict(list(template_files.items()) + list(env_files.items()))

        clients = self.app.client_manager
        orchestration_client = clients.rdomanager_oscplugin.orchestration()

        self.log.debug("Deploying stack: %s", stack_name)
        self.log.debug("Deploying template: %s", template)
        self.log.debug("Deploying parameters: %s", parameters)
        self.log.debug("Deploying environment: %s", env)
        self.log.debug("Deploying files: %s", files)

        stack_args = {
            'stack_name': stack_name,
            'template': template,
            'parameters': parameters,
            'environment': env,
            'files': files
        }

        if timeout:
            stack_args['timeout_mins'] = timeout

        if stack is None:
            self.log.info("Performing Heat stack create")
            orchestration_client.stacks.create(**stack_args)
        else:
            self.log.info("Performing Heat stack update")
            # Make sure existing parameters for stack are reused
            stack_args['existing'] = 'true'
            orchestration_client.stacks.update(stack.id, **stack_args)

        create_result = utils.wait_for_stack_ready(
            orchestration_client, stack_name)
        if not create_result:
            if stack is None:
                raise Exception("Heat Stack create failed.")
            else:
                raise Exception("Heat Stack update failed.")
1300976
void doneWithMeta()
    {
        parsingMeta = false;
        anyToVerify = !sigFileSigners.isEmpty();
        baos = null;
        sigFileData = null;
        pendingBlocks = null;
        signerCache = null;
        manDig = null;
        // MANIFEST.MF is always treated as signed and verified,
        // move its signers from sigFileSigners to verifiedSigners.
        if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
            verifiedSigners.put(JarFile.MANIFEST_NAME,
                    sigFileSigners.remove(JarFile.MANIFEST_NAME));
        }
    }
500947
function(name, cb){
		if(shuttingDown == true)
			return;
		if(!package.dependencies[name] && name != "isnode-mod-logger"){
			var error = { message: "Failed to load "+name+" Module - Module not referenced in node package file" };
			if(cb) { cb(error, null); }
			modules.logger.log("startup","ISNode System > " + error.message + ".");
			return; 
		}
		var modPresent = isModuleAvailable(name);
		if(modPresent){
			var nameSplit = name.split("-");
			if(nameSplit[0] != "isnode" && nameSplit[1] != "mod"){
				var error = { message: "Attempted to load a non 'ismod' or 'isnode' module with the isnode module loader" };
				modules.logger.log("warning","ISNode System > " + error.message + ".");
				if(cb) { cb(error, null); }
				return;
			} else if (nameSplit[2] == "interface" && nameSplit[3]){
				try {
					modules.interfaces[nameSplit[3]] = require(name)(isnode);
					var output = {
						success: true,
						message: "Interface module ("+nameSplit[3]+") successfully loaded"
					}
					modules.logger.log("debug", "ISNode System > " + output.message);
					if(cb) { cb(null,output); }
					return;
				} catch (err) {
					var error = { message: "System Error. Attempted to load module that does not exist - " + name };
					modules.logger.log("error","ISNode System > " + error.message, err);
					if(cb) { cb(error, null); }
					return;					
				}
			} else if (nameSplit[2] != "interface" && !nameSplit[3]) {
				try {
					modules[nameSplit[2]] = require(name)(isnode);
					var output = {
						success: true,
						message: "Standard module ("+nameSplit[2]+") successfully loaded"
					}
					modules.logger.log("debug", output.message + ".");
					if(cb) { cb(null, output); }
					return;
				} catch (err) {
					var error = { message: "System Error. Attempted to load module that does not exist - " + name, error: err };
					modules.logger.log("error","ISNode System > " + error.message+".", err);
					if(cb) { cb(error, null); }
					return;					
				}
			} else {
				var error = { message: "Attempted to load an unsupported ismod module with the ismod module loader" };
				modules.logger.log("warning","ISNode System > " + error.message + ".");
				if(cb) { cb(error, null); }
				return;
			}
		} else {
			if(name == "isnode-mod-logger"){
				modules.logger = {
					log: function(level,logMsg,attrObj){
						console.log("("+level+") "+logMsg);
					}
				}
				var error = { message: "Logger module not available. Polyfill method loaded in its place" };
				modules.logger.log("warning","ISNode System > " + error.message + ".");
				if(cb) { cb(error, null); }
			} else {
				var error = { message: "Attempted to load an ismod module ("+name+") that does not exist. Try running 'npm install'." };
				modules.logger.log("warning","ISNode System > " + error.message + ".");
				if(cb) { cb(error, null); }
			}
			return;
		}
	}
239944
def call_env_check_consistency(cls, kb_app, builder: StandaloneHTMLBuilder,
                                   sphinx_env: BuildEnvironment):
        

        for callback in EventAction.get_callbacks(kb_app,
                                                  SphinxEvent.ECC):
            callback(kb_app, builder, sphinx_env)
502661
NodeBuilder ascendToRoot()
    {
        NodeBuilder current = this;
        while (!current.isRoot())
            current = current.ascend();
        return current;
    }
1055624
def update(self, ng_template_id, name=NotUpdated, plugin_name=NotUpdated,
               hadoop_version=NotUpdated, flavor_id=NotUpdated,
               description=NotUpdated, volumes_per_node=NotUpdated,
               volumes_size=NotUpdated, node_processes=NotUpdated,
               node_configs=NotUpdated, floating_ip_pool=NotUpdated,
               security_groups=NotUpdated, auto_security_group=NotUpdated,
               availability_zone=NotUpdated,
               volumes_availability_zone=NotUpdated, volume_type=NotUpdated,
               image_id=NotUpdated, is_proxy_gateway=NotUpdated,
               volume_local_to_instance=NotUpdated, use_autoconfig=NotUpdated,
               shares=NotUpdated, is_public=NotUpdated,
               is_protected=NotUpdated, volume_mount_prefix=NotUpdated):
        """"""

        data = {}
        self._copy_if_updated(
            data, name=name, plugin_name=plugin_name,
            hadoop_version=hadoop_version, flavor_id=flavor_id,
            description=description, volumes_per_node=volumes_per_node,
            volumes_size=volumes_size, node_processes=node_processes,
            node_configs=node_configs, floating_ip_pool=floating_ip_pool,
            security_groups=security_groups,
            auto_security_group=auto_security_group,
            availability_zone=availability_zone,
            volumes_availability_zone=volumes_availability_zone,
            volume_type=volume_type, image_id=image_id,
            is_proxy_gateway=is_proxy_gateway,
            volume_local_to_instance=volume_local_to_instance,
            use_autoconfig=use_autoconfig, shares=shares,
            is_public=is_public, is_protected=is_protected,
            volume_mount_prefix=volume_mount_prefix
        )

        return self._update('/node-group-templates/%s' % ng_template_id, data,
                            'node_group_template')
1221094
function checkDepErrMsg(w, d) {
        var name = w.name || w.id;
        node.err(d + ' not found. ' + name + ' cannot be loaded');
    }
372829
function setupBotStatus(bot, node) {
    var updates = 0;
    var replies = 0;
    var updateText = function updateText() {
        return updates !== 1 ? updates + ' updates' : updates + ' update';
    };
    var replyText= function replyText() {
        return replies !== 1 ? replies + ' replies': replies + ' reply';
    };
    var updateStatus = function updateStatus() {
        node.status({fill: 'green', shape: 'dot',
            text: updateText() + '; ' + replyText()
        });
    };
    node.status({fill: 'grey', shape: 'ring', text: 'inactive'});
    bot.on('update', function updateCallback() {
        updates += 1;
        updateStatus();
    });

    bot.on('error', function errorCallback(error) {
        node.error(error);
        node.status({fill: 'red', shape: 'dot', text: 'error'});
    });

    bot.use('outgoing', function outgoingCallback(bot, update, message, next) {
        replies += 1;
        updateStatus();
        next();
    });
}
555941
def node_update(node, facts)
      logger.debug "  updating #{node}"
      connection[nodes_collection].find(_id: node).replace_one(facts,
        upsert: true,
        bypass_document_validation: true,
        check_keys: false,
        validating_keys: false)
    rescue ::Mongo::Error::OperationFailure => e
      logger.warn "  updating #{node} failed with: #{e.message}"
      # mongodb doesn't support keys with a dot
      # see https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names
      # as a dirty workaround we delete the document and insert it ;-)
      # The dotted field .. in .. is not valid for storage. (57)
      # .. is an illegal key in MongoDB. Keys may not start with '$' or contain a '.'.
      # (BSON::String::IllegalKey)
      raise e unless e.message =~ /The dotted field / || e.message =~ /is an illegal key/
      logger.warn "    we transform the dots into underline characters"
      begin
        facts = Hash[facts.map { |k, v| [k.tr('.', '_'), v] }]
        connection[nodes_collection].find(_id: node).replace_one(facts,
          upsert: true,
          bypass_document_validation: true,
          check_keys: false,
          validating_keys: false)
      rescue
        logger.error "  inserting node #{node} failed again with: #{e.message}"
      end
    end
349614
def update_stack(params)
      unless stack_exists?(@stack_name)
        puts "Cannot update a stack because the #{@stack_name} does not exists."
        return
      end
      exist_unless_updatable(stack_status(@stack_name))

      message = "Updating #{@stack_name} stack"
      error = nil
      if @options[:noop]
        message = "NOOP #{message}"
      else
        diff.run if @options[:diff]
        preview.run if @options[:preview]
        are_you_sure?(:update)

        if @options[:change_set] # defaults to this
          message << " via change set: #{preview.change_set_name}"
          change_set_update
        else
          standard_update(params)
        end
      end
      puts message unless @options[:mute] || error
    end
400555
public static void assertJsonNodeAbsent(Object actual, String path) {
        if (!nodeAbsent(actual, path, configuration)) {
            doFail("Node \"" + path + "\" is present.");
        }
    }
180253
function check() {
    module.hot.check(function(err, updatedModules) {
      if (err) return handleError(err);

      if (!updatedModules) {
        logger.warn('Cannot find update any update.');
        return;
      }

      apply(updatedModules);
    });
  }
950108
function(newnode, oldnode, lastnode, id, ids) {
		var result = true;
		var isSoftUpdate = false;
		var isPluginUpdate = false; // TODO: plugins...
		if ((newnode && !oldnode) || (!newnode && oldnode)) {
			result = false;
		} else if ((result = newnode.nodeType === oldnode.nodeType)) {
			switch (oldnode.nodeType) {
				case Node.TEXT_NODE:
					if (newnode.data !== oldnode.data) {
						result = false;
					}
					break;
				case Node.ELEMENT_NODE:
					if ((result = this._familiar(newnode, oldnode))) {
						if ((result = this._checkatts(newnode, oldnode, ids))) {
							if (this._maybesoft(newnode, oldnode)) {
								if (this._confirmsoft(newnode, oldnode)) {
									this._updatesoft(newnode, oldnode, ids);
									isSoftUpdate = true; // prevents the replace update
								}
								result = false; // crawling continued in _updatesoft
							} else {
								if (oldnode.localName !== "textarea") { // TODO: better forms support!
									result = newnode.childNodes.length === oldnode.childNodes.length;
									if (!result && oldnode.id) {
										lastnode = newnode;
										id = oldnode.id;
									}
								}
							}
						}
					}
					break;
			}
		}
		if (!result && !isSoftUpdate && !isPluginUpdate) {
			this._updates.collect(new edbml.FunctionUpdate(this._doc).setup(id));
			this._updates.collect(new edbml.HardUpdate(this._doc).setup(id, lastnode));
		}
		return result;
	}
1349668
def check_nodes_to_prepare(project_root, environment)
      nodes_to_prepare = []
      nodes = Bebox::Node.nodes_in_environment(project_root, environment, 'nodes')
      prepared_nodes = Bebox::Node.list(project_root, environment, 'prepared_nodes')
      nodes.each do |node|
        if prepared_nodes.include?(node.hostname)
          message = _('wizard.node.confirm_preparation')%{hostname: node.hostname, start: node.checkpoint_parameter_from_file('prepared_nodes', 'started_at'), end: node.checkpoint_parameter_from_file('prepared_nodes', 'finished_at')}
          nodes_to_prepare << node if confirm_action?(message)
        else
          nodes_to_prepare << node
        end
      end
      nodes_to_prepare
    end
557995
function MasterNode(io, config, pass) {
  EventEmitter.call(this);
  this.connected = [];  // array of connected clients.
  this.disconnected = []; // an array of disconnected and removed clients.
  this.disconnecting = [];  //array of disconnecting clients (didn't reconnect within 10sec)
  this.io = io;
  this.config = config;
  this.config.password = crux.util.sha2(pass);
  this.__loadDump();
  this.bind();
}
300243
final void verifyMaster() {
        NodeEngine nodeEngine = getNodeEngine();
        Address masterAddress = nodeEngine.getMasterAddress();

        if (!migrationInfo.getMaster().equals(masterAddress)) {
            throw new IllegalStateException("Migration initiator is not master node! => " + toString());
        }

        if (getMigrationParticipantType() == MigrationParticipant.SOURCE && !masterAddress.equals(getCallerAddress())) {
            throw new IllegalStateException("Caller is not master node! => " + toString());
        }
    }
34679
def _check_deployed_nodes(nodes):
    """"""
    deployed = []
    undeployed = []
    cmd = "! (mount | grep -E '^/dev/[[:alpha:]]+2 on / ')"

    deployed_check = get_execo_remote(
        cmd,
        nodes,
        DEFAULT_CONN_PARAMS)

    for p in deployed_check.processes:
        p.nolog_exit_code = True
        p.nolog_timeout = True
        p.nolog_error = True
        p.timeout = 10
    deployed_check.run()

    for p in deployed_check.processes:
        if p.ok:
            deployed.append(p.host.address)
        else:
            undeployed.append(p.host.address)

    return deployed, undeployed