本文整理匯總了Python中chef.Node.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Node.get方法的具體用法?Python Node.get怎麽用?Python Node.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類chef.Node
的用法示例。
在下文中一共展示了Node.get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_nodes
# 需要導入模塊: from chef import Node [as 別名]
# 或者: from chef.Node import get [as 別名]
def create_nodes(cluster, facet):
"""Initialize Chef nodes"""
instances = create_instances(cluster, facet)
for nodename, ipaddress in instances:
node = Node(nodename)
if node.exists:
node_ipaddress = node.get('ipaddress')
if ipaddress is None and node_ipaddress:
ipaddress = node_ipaddress
elif node_ipaddress and node_ipaddress != ipaddress:
raise Exception('The remote IP address is different: %s' % node_ipaddress)
if ipaddress is None:
raise Exception('Can not determine the IP address for %s' % nodename)
node['ipaddress'] = ipaddress
# update environment and run_list
node.chef_environment = cluster.environment
run_list = list(cluster.run_list)
run_list.extend(facet.run_list)
# tagging the cluster
run_list.append(u'role[%s_cluster]' % cluster.name)
run_list.append(u'role[%s_%s]'% (cluster.name, facet.name))
for role in run_list:
if role not in node.run_list:
node.run_list.append(role)
facet.nodes[ipaddress] = node