本文整理汇总了Python中chef.Node.run_list方法的典型用法代码示例。如果您正苦于以下问题:Python Node.run_list方法的具体用法?Python Node.run_list怎么用?Python Node.run_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chef.Node
的用法示例。
在下文中一共展示了Node.run_list方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_computes
# 需要导入模块: from chef import Node [as 别名]
# 或者: from chef.Node import run_list [as 别名]
def build_computes(computes):
# Run computes
print "Making the compute nodes..."
for compute in computes:
compute_node = Node(compute)
compute_node['in_use'] = "compute"
compute_node.run_list = ["role[qa-single-compute]"]
compute_node.save()
print "Updating server...this may take some time"
update_node(compute_node)
if compute_node['platform_family'] == 'rhel':
print "Platform is RHEL family, disabling iptables"
disable_iptables(compute_node)
# Run chef client twice
print "Running chef-client on compute node: %s, this may take some time..." % compute
run1 = run_chef_client(compute_node)
if run1['success']:
print "First chef-client run successful...starting second run..."
run2 = run_chef_client(compute_node)
if run2['success']:
print "Second chef-client run successful..."
else:
print "Error running chef-client for compute %s" % compute
print run2
sys.exit(1)
else:
print "Error running chef-client for compute %s" % compute
print run1
sys.exit(1)
示例2: build_dir_server
# 需要导入模块: from chef import Node [as 别名]
# 或者: from chef.Node import run_list [as 别名]
def build_dir_server(dir_server):
# We dont support 389 yet, so exit if it is not ldap
if results.dir_version != 'openldap':
print "%s as a directory service is not yet supported...exiting" % results.dir_version
sys.exit(1)
# Build directory service node
dir_node = Node(dir_server)
ip = dir_node['ipaddress']
root_pass = razor.get_active_model_pass(dir_node['razor_metadata'].to_dict()['razor_active_model_uuid'])['password']
dir_node['in_use'] = 'directory-server'
dir_node.run_list = ["role[qa-%s-%s]" % (results.dir_version, results.os)]
dir_node.save()
print "Updating server...this may take some time"
update_node(dir_node)
# if redhat platform, disable iptables
if dir_node['platform_family'] == 'rhel':
print "Platform is RHEL family, disabling iptables"
disable_iptables(dir_node)
# Run chef-client twice
print "Running chef-client for directory service node...this may take some time..."
run1 = run_chef_client(dir_node)
if run1['success']:
print "First chef-client run successful...starting second run..."
run2 = run_chef_client(dir_node)
if run2['success']:
print "Second chef-client run successful..."
else:
print "Error running chef-client for directory node %s" % dir_node
print run2
sys.exit(1)
else:
print "Error running chef-client for directory node %s" % dir_node
print run1
sys.exit(1)
# Directory service is set up, need to import config
if run1['success'] and run2['success']:
if results.dir_version == 'openldap':
scp_run = run_remote_scp_cmd(ip, 'root', root_pass, '/var/lib/jenkins/source_files/ldif/*.ldif')
if scp_run['success']:
ssh_run = run_remote_ssh_cmd(ip, 'root', root_pass, 'ldapadd -x -D \"cn=admin,dc=dev,dc=rcbops,dc=me\" -f base.ldif [email protected]')
elif results.dir_version == '389':
# Once we support 389, code here to import needed config files
print "389 is not yet supported..."
sys.exit(1)
else:
print "%s is not supported...exiting" % results.dir_version
sys.exit(1)
if scp_run['success'] and ssh_run['success']:
print "Directory Service: %s successfully set up..." % results.dir_version
else:
print "Failed to set-up Directory Service: %s..." % results.dir_version
sys.exit(1)
示例3: add_run_list_item
# 需要导入模块: from chef import Node [as 别名]
# 或者: from chef.Node import run_list [as 别名]
def add_run_list_item(self, items):
"""
Adds list of items to run_list
"""
util.logger.debug("run_list:{0} add:{1}".format(self.run_list, items))
self.run_list.extend(items)
cnode = ChefNode(self.name, api=self.environment.local_api)
cnode.run_list = self.run_list
self.save(cnode)
示例4: build
# 需要导入模块: from chef import Node [as 别名]
# 或者: from chef.Node import run_list [as 别名]
def build(self):
""" Builds the node
"""
# clear run_list
self.run_list = []
node = ChefNode(self.name, self.environment.local_api)
node.run_list = []
node.save()
super(Chef, self).build()
示例5: remove_run_list_item
# 需要导入模块: from chef import Node [as 别名]
# 或者: from chef.Node import run_list [as 别名]
def remove_run_list_item(self, item):
"""
Adds list of items to run_list
"""
util.logger.debug("run_list:{0} remove:{1}".format(self.run_list,
item))
self.run_list.pop(self.run_list.index(item))
cnode = ChefNode(self.name, api=self.environment.local_api)
cnode.run_list = self.run_list
self.save(cnode)
示例6: build_controller
# 需要导入模块: from chef import Node [as 别名]
# 或者: from chef.Node import run_list [as 别名]
def build_controller(controller, ha=False, ha_num=0):
controller_node = Node(controller)
# Check for ha
if ha:
print "Making %s the ha-controller%s node" % (controller, ha_num)
controller_node['in_use'] = "ha-controller%s" % ha_num
controller_node.run_list = ["role[qa-ha-controller%s]" % ha_num]
else:
print "Making %s the controller node" % controller
controller_node['in_use'] = "controller"
controller_node.run_list = ["role[qa-single-controller]"]
# save node
controller_node.save()
print "Updating server...this may take some time"
update_node(controller_node)
if controller_node['platform_family'] == 'rhel':
print "Platform is RHEL family, disabling iptables"
disable_iptables(controller_node)
# Run chef-client twice
print "Running chef-client for controller node...this may take some time..."
run1 = run_chef_client(controller_node)
if run1['success']:
print "First chef-client run successful...starting second run..."
run2 = run_chef_client(controller_node)
if run2['success']:
print "Second chef-client run successful..."
else:
print "Error running chef-client for controller %s" % controller
print run2
sys.exit(1)
else:
print "Error running chef-client for controller %s" % controller
print run1
sys.exit(1)