本文整理汇总了Python中fuelclient.objects.environment.Environment.execute_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.execute_tasks方法的具体用法?Python Environment.execute_tasks怎么用?Python Environment.execute_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuelclient.objects.environment.Environment
的用法示例。
在下文中一共展示了Environment.execute_tasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute_tasks
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import execute_tasks [as 别名]
def execute_tasks(self, params):
"""Execute deployment tasks
fuel node --node 2 --tasks hiera netconfig
fuel node --node 2 --skip hiera netconfig
fuel node --node 2 --skip rsync --end pre_deployment
fuel node --node 2 --end netconfig
fuel node --node 2 --start hiera --end neutron
fuel node --node 2 --start post_deployment
"""
node_collection = NodeCollection.init_with_ids(params.node)
env_id_to_start = self.get_env_id(node_collection)
env = Environment(env_id_to_start)
if params.tasks:
tasks = params.tasks
else:
tasks = env.get_tasks(
skip=params.skip, end=params.end, start=params.start)
task = env.execute_tasks(node_collection.collection, tasks=tasks)
self.serializer.print_to_output(
task.data,
"Started tasks {0} for nodes {1}.".format(tasks, node_collection))
示例2: execute_tasks
# 需要导入模块: from fuelclient.objects.environment import Environment [as 别名]
# 或者: from fuelclient.objects.environment.Environment import execute_tasks [as 别名]
def execute_tasks(self, params):
"""Execute deployment tasks
fuel node --node 2 --tasks hiera netconfig
fuel node --node 2 --tasks netconfig --force
fuel node --node 2 --skip hiera netconfig
fuel node --node 2 --skip rsync --end pre_deployment_end
fuel node --node 2 --end netconfig
fuel node --node 2 --start hiera --end neutron
fuel node --node 2 --start post_deployment_start
"""
node_collection = NodeCollection.init_with_ids(params.node)
env_id_to_start = self.get_env_id(node_collection)
env = Environment(env_id_to_start)
tasks = params.tasks or None
force = params.force or None
if params.skip or params.end or params.start:
tasks = env.get_tasks(
skip=params.skip,
end=params.end,
start=params.start,
include=tasks)
if not tasks:
self.serializer.print_to_output({}, "Nothing to run.")
return
task = env.execute_tasks(
node_collection.collection, tasks=tasks, force=force)
self.serializer.print_to_output(
task.data,
"Started tasks {0} for nodes {1}.".format(tasks, node_collection))