def available_node(self, image, deployment): """Provides a free node from chef pool. :param image: name of os image :type image: string :param deployment: ChefDeployment to add node to :type deployment: Deployment :rtype: Node """ # TODO: Should probably search on system name node attributes # Avoid specific naming of razor nodes, not portable nodes = node_utils.node_search("name:qa-%s-pool*" % image) for node in nodes: is_default = node.chef_environment == "_default" iface_in_run_list = "recipe[network-interfaces]" in node.run_list if is_default and iface_in_run_list: node.chef_environment = deployment.environment.name node['in_use'] = "provisioning" node.save() return node deployment.destroy() raise Exception("No more nodes!!")
def available_node(self, image, deployment): """Provides a free node from chef pool. :param image: name of os image :type image: string :param deployment: ChefDeployment to add node to :type deployment: Deployment :rtype: Node """ # TODO: Should probably search on system name node attributes # Avoid specific naming of razor nodes, not portable nodes = node_utils.node_search("name:node*") for node in nodes: is_default = node.chef_environment == "_default" iface_in_run_list = "recipe[rcbops-qa]" in node.run_list if is_default and iface_in_run_list: node.chef_environment = deployment.environment.name node['in_use'] = "provisioning" node.save() return node deployment.destroy() logger.info("Cannot build, no more available_nodes") sys.exit(1)