def replace_host_software(ctx, **kwargs): graph = ctx.graph_mode() for node in ctx.nodes: for instance in node.instances: if _is_host_node(instance): if sys.argv[4] == "migration_uninstall": generate_tasks_fun = _host_pre_stop else: def generate_tasks_fun(instance): return _host_post_start(instance) + [ instance.execute_operation( 'cloudify.interfaces.monitoring.start') ] sequence = graph.sequence() sequence.add(*generate_tasks_fun(instance)) time.sleep(2) graph.execute()
def replace_host_software(ctx, op_name, **kwargs): graph = ctx.graph_mode() for node in ctx.nodes: for instance in node.instances: if _is_host_node(instance): if op_name == "uninstall": generate_tasks_fun = _host_pre_stop elif op_name == "install": def generate_tasks_fun(instance): tasks = _host_post_start(instance) for subnode in instance.get_contained_subgraph(): tasks.append( subnode.execute_operation( 'cloudify.interfaces.monitoring.start')) return tasks else: raise NonRecoverableError('Unrecognized operation %s' % op_name) sequence = graph.sequence() sequence.add(*generate_tasks_fun(instance)) graph.execute()
def replace_host_software(ctx, op_name, **kwargs): graph = ctx.graph_mode() for node in ctx.nodes: for instance in node.instances: if _is_host_node(instance): if op_name == "uninstall": generate_tasks_fun = _host_pre_stop elif op_name == "install": def generate_tasks_fun(instance): tasks = _host_post_start(instance) for subnode in instance.get_contained_subgraph(): tasks.append( subnode.execute_operation( 'cloudify.interfaces.monitoring.start') ) return tasks else: raise NonRecoverableError( 'Unrecognized operation %s' % op_name) sequence = graph.sequence() sequence.add(*generate_tasks_fun(instance)) graph.execute()