def post_post_deploy_compute_node(target, output=True): '''post deployment hook for controller''' func_name = 'mc_cloud_lxc.post_post_deploy_compute_node {0}'.format( target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) ret = result() nodetypes_reg = cli('mc_nodetypes.registry') slss, pref = [], 'makina-states.cloud.lxc.compute_node' if nodetypes_reg['is']['devhost']: slss.append('{0}.devhost'.format(pref)) if slss: ret = __salt__['mc_api.apply_sls']( slss, **{'salt_target': target, 'ret': ret}) msg = 'Post installation: {0}\n' if ret['result']: clr = green status = 'sucess' else: clr = red status = 'failure' ret['comment'] += clr(msg.format(status)) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def orchestrate(compute_node, skip=None, only=None, output=True, refresh=False, ret=None): '''install all compute node vms :: mastersalt-run -lall mc_cloud_vm.orchestrate host1.domain.tld mastersalt-run -lall mc_cloud_vm.orchestrate host1.domain.tld only=['foo.domain.tld'] mastersalt-run -lall mc_cloud_vm.orchestrate host1.domain.tld skip=['foo2.domain.tld'] ''' func_name = 'mc_cloud_vm.orchestrate' __salt__['mc_api.time_log']('start {0}'.format(func_name)) __salt__['mc_api.time_log'](func_name) if refresh: cli('saltutil.refresh_pillar') ret = provision_vms(compute_node, skip=skip, only=only, output=output, refresh=False, ret=ret) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def cn_sls_pillar(target, ttl=api.RUNNER_CACHE_TIME, output=False): '''limited cloud pillar to expose to a compute node''' func_name = 'mc_cloud_lxc.cn_sls_pillar {0}'.format(target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) def _do(target): pillar = {} imgSettings = cli('mc_cloud_images.settings') lxcSettings = cli('mc_cloud_lxc.settings') imgSettingsData = {} lxcSettingsData = {} for name, imageData in imgSettings['lxc']['images'].items(): imgSettingsData[name] = { 'lxc_tarball': imageData['lxc_tarball'], 'lxc_tarball_md5': imageData['lxc_tarball_md5'], 'lxc_tarball_name': imageData['lxc_tarball_name'], 'lxc_tarball_ver': imageData['lxc_tarball_ver']} for v in ['use_bridge', 'bridge', 'gateway', 'netmask_full', 'network', 'netmask']: lxcSettingsData[v] = lxcSettings['defaults'][v] # imgSettingsData = api.json_dump(imgSettingsData) # lxcSettingsData = api.json_dump(lxcSettingsData) pillar.update({'lxcSettings': lxcSettingsData, 'imgSettings': imgSettingsData}) return pillar cache_key = 'mc_cloud_lxc.cn_sls_pillar_{0}'.format(target) ret = memoize_cache(_do, [target], {}, cache_key, ttl) cret = result() cret['result'] = ret salt_output(cret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def report(targets, ret=None, refresh=False, output=True): '''Parse all reachable compute nodes and vms and regenerate the local configuration registries concerning cloud deployment''' func_name = 'mc_compute_node.register_configurations' __salt__['mc_api.time_log']('start {0}'.format(func_name)) settings = cli('mc_cloud_compute_node.settings') if ret is None: ret = result() if refresh: cli('saltutil.refresh_pillar') sret = '' if not isinstance(targets, list): targets = targets.split(',') for target in targets: # if compute_node if target in settings['targets']: for vm in settings['targets'][target]['vms']: if vm not in targets: targets.append(vm) for idx, target in enumerate(targets): try: if not cli('test.ping', salt_target=target): continue except Exception: continue sret += '{0}'.format( cli('mc_project.report', salt_target=target) ) ret['result'] = sret salt_output(ret, __opts__, output=output, onlyret=True) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def deploy(target, output=True, ret=None, hooks=True, pre=True, post=True): '''Prepare cloud controller configuration can also apply per virtualization type configuration''' __salt__['mc_cloud_compute_node.lazy_register_configuration'](target) func_name = 'mc_compute_node.deploy {0}'.format(target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() ret['comment'] += green('Installing compute node configuration\n') if hooks and pre: run_vt_hook('pre_deploy_compute_node', ret=ret, target=target, output=output) for step in [ register_configuration, configure_prevt, # merged in configure_prevt for perf reason # configure_sshkeys, # configure_grains, install_vts, configure_network, configure_host, # merged in configure_host for perf reason # configure_hostsfile, # configure_firewall, # configure_sslcerts, # configure_reverse_proxy ]: step(target, ret=ret, output=False) check_point(ret, __opts__, output=output) if hooks and post: run_vt_hook('post_deploy_compute_node', ret=ret, target=target, output=output) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def register_configuration(target, ret=None, output=True): ''' drop the compute node configuration ''' func_name = 'mc_compute_node.register_configuration {0}'.format(target) if ret is None: ret = result() __salt__['mc_api.time_log']('start {0}'.format(func_name)) settings = __salt__['mc_cloud_compute_node.cn_sls_pillar'](target) cret = cli( 'mc_macros.update_local_registry', 'cloud_compute_node_settings', settings, registry_format='pack', salt_target=target) if ( isinstance(cret, dict) and( 'makina-states.local.' 'cloud_compute_node_settings.cnSettings' in cret ) ): ret['result'] = True ret['comment'] += yellow('Configuration stored' ' on {0}\n'.format(target)) else: ret['result'] = False ret['comment'] += red('Configuration failed to store' ' on {0}\n'.format(target)) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def vm_ping(vm, compute_node=None, vt=None, ret=None, output=True): '''ping a specific vm on a specific compute node compute_node where to act vm vm to ping :: mastersalt-run -lall mc_cloud_vm.vm_ping foo.domain.tld ''' __salt__['mc_cloud_vm.lazy_register_configuration']( vm, compute_node) func_name = 'mc_cloud_vm.provision.ping {0}'.format(vm) __salt__['mc_api.time_log']('start {0}'.format(func_name)) vt = __salt__['mc_cloud_vm.get_vt'](vm, vt) compute_node = __salt__['mc_cloud_vm.get_compute_node'](vm, compute_node) if ret is None: ret = result() try: ping = cli('test.ping', salt_target=vm) except Exception: ret['trace'] += "{0}\n".format(traceback.format_exc()) ping = False ret['result'] = ping if ret['result']: comment = green('VM {0} is pinguable\n') else: comment = red('VM {0} is unreachable\n') ret['comment'] += comment.format(vm) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def provision(vm, compute_node=None, vt=None, steps=None, ret=None, output=True): '''provision a vm compute_node where to act vt virtual type vm vm to spawn steps list or comma separated list of steps Default:: ['spawn', 'hostsfile', 'sshkeys', 'grains', 'initial_setup', 'initial_highstate'] :: mastersalt-run -lall mc_cloud_vm.provision foo.domain.tld ''' func_name = 'mc_cloud_vm.provision {0}'.format(vm) __salt__['mc_api.time_log']('start {0}'.format(func_name)) vt = __salt__['mc_cloud_vm.get_vt'](vm, vt) compute_node = __salt__['mc_cloud_vm.get_compute_node'](vm, compute_node) vt = __salt__['mc_cloud_vm.get_vt'](vm, vt) if isinstance(steps, basestring): steps = steps.split(',') if steps is None: steps = ['register_configuration_on_cn', 'spawn', 'register_configuration', 'preprovision', # 'sshkeys', # 'hostsfile', # 'grains', # 'markers', 'initial_setup', 'initial_highstate'] if ret is None: ret = result() for step in steps: cret = __salt__['mc_cloud_vm.step'](vm, step, compute_node=compute_node, vt=vt, output=False) merge_results(ret, cret) if ret['result']: ret['comment'] += green( '{0}/{1}/{2} deployed\n').format(compute_node, vt, vm) else: ret['comment'] += red( '{0}/{1}/{2} failed to deploy\n').format(compute_node, vt, vm) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def register_configuration(vm, compute_node=None, vt=None, ret=None, output=True, salt_target=None): ''' Register the configuration on the 'salt_target' node as a local registry salt_target is aimed to be the vm as default but can be any other reachable minion. Idea is that we copy this configuration on the compute node at first to provision the vm with the rights settings. ''' compute_node = __salt__['mc_cloud_vm.get_compute_node'](vm, compute_node) func_name = 'mc_cloud_vm.register_configuration {0}'.format(vm) suf = '' if not salt_target: salt_target = vm if salt_target != vm: suf = '_{0}'.format(vm) if ret is None: ret = result() __salt__['mc_api.time_log']('start {0}'.format(func_name)) settings = __salt__['mc_cloud_vm.vm_sls_pillar'](compute_node, vm) cret = cli( 'mc_macros.update_local_registry', 'cloud_vm_settings{0}'.format(suf), settings, registry_format='pack', salt_target=salt_target) if ( isinstance(cret, dict) and( ( 'makina-states.local.' 'cloud_vm_settings{0}.vmSettings'.format( suf ) in cret ) ) ): ret['result'] = True ret['comment'] += yellow('VM Configuration stored' ' on {0}\n'.format(salt_target)) else: ret['result'] = False ret['comment'] += red('VM Configuration failed to store' ' on {0}\n'.format(salt_target)) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def _configure(what, target, ret, output): __salt__['mc_cloud_compute_node.lazy_register_configuration'](target) func_name = 'mc_compute_node._configure {0} {1}'.format(what, target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() ret['comment'] += yellow('Installing {1} on {0}\n'.format(target, what)) ret = __salt__['mc_api.apply_sls']( '{0}.{1}'.format(_GPREF, what), **{ 'salt_target': target, 'ret': ret}) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def post_deploy_controller(output=True): '''Prepare cloud controller LXC configuration''' func_name = 'mc_cloud_lxc.post_deploy_controller' __salt__['mc_api.time_log']('start {0}'.format(func_name)) ret = result() ret['comment'] = yellow('Installing controller lxc configuration\n') pref = 'makina-states.cloud.lxc.controller' ret = __salt__['mc_api.apply_sls']( ['{0}.postdeploy'.format(pref)], **{'ret': ret}) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def vm_initial_highstate(vm, compute_node=None, vt=None, ret=None, output=True): '''Run the initial highstate, this step will run only once and will further check for the existence of <saltroot>/makina-states/.initial_hs file compute_node where to act vm vm to run highstate on :: mastersalt-run -lall mc_cloud_vm.vm_initial_highstate foo.domain.tld ''' __salt__['mc_cloud_vm.lazy_register_configuration']( vm, compute_node) compute_node = __salt__['mc_cloud_vm.get_compute_node'](vm, compute_node) if not ret: ret = result() pillar = __salt__['mc_cloud_vm.vm_sls_pillar'](compute_node, vm) vt = __salt__['mc_cloud_vm.get_vt'](vm, vt) cmd = ("ssh -o\"ProxyCommand=ssh {target} nc -w300 {vm} 22\"" " footarget {cloudSettings[root]}/makina-states/" "_scripts/boot-salt.sh " "--initial-highstate").format(vm=vm, target=compute_node, cloudSettings=pillar['cloudSettings']) unless = ("ssh -o\"ProxyCommand=ssh {target} " "nc -w300 {vm} 22\" footarget " "test -e '/etc/makina-states/initial_highstate'").format( vm=vm, target=compute_node, cloudSettings=pillar['cloudSettings']) cret = cli('cmd.run_all', unless) if cret['retcode']: rcret = cli('cmd.run_all', cmd, use_vt=True, output_loglevel='info') if not rcret['retcode']: ret['comment'] = ( 'Initial highstate done on {0}'.format(vm) ) else: ret['result'] = False ret['trace'] += rcret['stdout'] + '\n' ret['trace'] += rcret['stderr'] + '\n' ret['comment'] += ( 'Initial highstate failed on {0}\n'.format(vm) ) else: ret['comment'] += 'Initial highstate already done on {0}\n'.format(vm) salt_output(ret, __opts__, output=output) return ret
def install_vts(target, ret=None, output=True): '''install all virtual types to be ready to host vms''' func_name = 'mc_compute_node.install_vts {0}'.format(target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() ret = run_vt_hook('install_vt', ret=ret, target=target, output=output) if ret['result']: ret['comment'] += yellow( '{0} is now ready to host vms\n'.format(target)) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def dns_conf(output=True, ret=None): '''Prepare cloud controller dns (BIND) server''' func_name = 'mc_cloud_controller.dns_conf' __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() kw = {'ret': ret, 'output': output} kw['ret']['comment'] += green( 'Installing cloud controller DNS configuration\n') run_vt_hook('pre_dns_conf_on_controller', ret=kw['ret'], output=output) __salt__['mc_api.apply_sls']( ['makina-states.cloud.generic.controller.dnsconf'], **kw) check_point(kw['ret'], __opts__, output=output) run_vt_hook('post_dns_conf_on_controller', ret=kw['ret'], output=output) salt_output(kw['ret'], __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return kw['ret']
def post_deploy(target, ret=None, output=True): '''Prepare cloud controller configuration can also apply per virtualization type configuration''' func_name = 'mc_compute_node.post_deploy {0}'.format(target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() hook = 'pre_post_deploy_compute_node' run_vt_hook(hook, ret=ret, target=target, output=output) for step in []: step(target, ret=ret, output=False) check_point(ret, __opts__, output=output) hook = 'post_post_deploy_compute_node' run_vt_hook(hook, ret=ret, target=target, output=output) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def _vm_configure(what, target, compute_node, vm, ret, output): __salt__['mc_cloud_vm.lazy_register_configuration'](vm, compute_node) func_name = 'mc_cloud_lxc._vm_configure {0} {1} {2} {3}'.format( what, target, compute_node, vm) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() ret['comment'] += yellow( 'LXC: Installing {2} on vm ' '{0}/{1}\n'.format(compute_node, vm, what)) pref = 'makina-states.cloud.lxc.vm' ret = __salt__['mc_api.apply_sls']( '{0}.{1}'.format(pref, what), **{ 'salt_target': target, 'ret': ret}) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def install_vt(target, output=True): '''install & configure lxc''' func_name = 'mc_cloud_lxc.install_vt {0}'.format( target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) ret = result() ret['comment'] += yellow('Installing lxc on {0}\n'.format(target)) for step in [configure_grains, configure_install_lxc, configure_images]: try: step(target, ret=ret, output=False) except FailedStepError: pass __salt__['mc_cloud_lxc.sync_images'](target, output=False, ret=ret) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def sync_images(target, output=True, ret=None): '''sync images on target''' func_name = 'mc_cloud_lxc.sync_images {0}'.format( target) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() iret = __salt__['mc_lxc.sync_images'](only=[target]) if iret['result']: ret['comment'] += yellow( 'LXC: images synchronnised on {0}\n'.format(target)) else: merge_results(ret, iret) ret['comment'] += yellow( 'LXC: images failed to synchronnise on {0}\n'.format(target)) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def deploy(output=True, ret=None): '''Prepare cloud controller configuration can also apply per virtualization type configuration''' func_name = 'mc_cloud_controller.deploy' __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() kw = {'ret': ret, 'output': output} kw['ret']['comment'] += green( 'Installing cloud controller configuration files\n') run_vt_hook('pre_deploy_controller', ret=kw['ret'], output=output) __salt__['mc_api.apply_sls']( ['makina-states.cloud.generic.controller', 'makina-states.cloud.saltify'], **kw) check_point(kw['ret'], __opts__, output=output) run_vt_hook('post_deploy_controller', ret=kw['ret'], output=output) salt_output(kw['ret'], __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return kw['ret']
def post_provision(vm, compute_node=None, vt=None, ret=None, output=True): '''post provision a vm compute_node where to act vt virtual type vm vm to spawn steps list or comma separated list of steps Default:: ['ping', 'post_provision_hook'] :: mastersalt-run -lall mc_cloud_vm.post_provision foo.domain.tld ''' func_name = 'mc_cloud_vm.post_provision {0}'.format(vm) __salt__['mc_api.time_log']('start {0}'.format(func_name)) if ret is None: ret = result() vt = __salt__['mc_cloud_vm.get_vt'](vm, vt) compute_node = __salt__['mc_cloud_vm.get_compute_node'](vm, compute_node) for step in ['ping', 'post_provision_hook']: cret = __salt__['mc_cloud_vm.step'](vm, step, compute_node=compute_node, vt=vt, output=False) merge_results(ret, cret) if ret['result']: ret['comment'] += green( '{0}/{1}/{2} deployed\n').format(compute_node, vt, vm) else: ret['comment'] += red( '{0}/{1}/{2} failed to deploy\n').format(compute_node, vt, vm) salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
).format(name, csettings['root'], proxycmd) cmdret = cli('cmd.run_all', cmd) if cmdret['retcode']: ret['result'] = False ret['trace'] += 'Using cmd: \'{0}\''.format(cmd) ret['trace'] += '{0}\n'.format(cmdret['stdout']) ret['trace'] += '{0}\n'.format(cmdret['stderr']) ret['comment'] += red( 'SALTIFY: Error in highstate for {0}'.format(name)) check_point(ret, __opts__) # ok, marking initial highstate done cli('mc_cloud_compute_node.set_conf_for_target', name, 'saltified', True) except FailedStepError: ret['result'] = False salt_output(ret, __opts__, output=output) salt_output(ret, __opts__, output=output) return ret def filter_compute_nodes(nodes, skip, only): '''filter compute nodes to run on''' targets = [] for a in nodes: if a not in skip and a not in targets: targets.append(a) if only: if isinstance(only, basestring): if ',' not in only: only = [only] else:
def orchestrate(skip=None, skip_vms=None, only=None, only_vms=None, no_compute_node_provision=False, no_provision=False, no_post_provision=False, no_vms_post_provision=False, no_vms=False, output=True, refresh=True, ret=None): '''Orchestrate the whole cloud deployment. In this order: - provision compute nodes minus the skipped one and limiting to the 'only' if any - provision vms minus the skipped one and limiting to the 'only_compute_vm' if any. If the vms are to be hosted on a failed host, they will be skipped - post provision compute nodes - post provision vms skip list or comma separated string of compute node to skip (will skip contained vms too) only list or comma separated string of compute node If set, it will only provision those compute nodes and contained vms no_provision do not run the compute nodes provision no_post_provision do not run the compute nodes post provision no_compute_node_provision skip configuration of compute nodes skip_vms list or comma separated string of vms to skip only_vms list or comma separated string of vms. If set, it will only provision those vms no_vms do not run the vm provision no_vms_post_provision do not run the vms post provision ''' func_name = 'mc_compute_node.orchestrate' __salt__['mc_api.time_log']('start {0}'.format(func_name)) if refresh: cli('saltutil.refresh_pillar') if ret is None: ret = result() chg = ret['changes'] lresult = True only, only_vms, skip, skip_vms = ( __salt__['mc_cloud_controller.gather_only_skip']( only=only, only_vms=only_vms, skip=skip, skip_vms=skip_vms)) if not no_provision: provision_compute_nodes( skip=skip, only=only, no_compute_node_provision=no_compute_node_provision, output=False, refresh=False, ret=ret) for a in ret.setdefault('cns_in_error', []): if a not in skip: lresult = False skip.append(a) if not no_vms: for compute_node in chg.setdefault('cns_provisionned', []): __salt__['mc_cloud_vm.orchestrate']( compute_node, output=False, skip=skip_vms, only=only_vms, refresh=False, ret=ret) vms_in_error = chg.setdefault('vms_in_error', {}) for node in vms_in_error: for vm in vms_in_error[node]: if vm not in skip_vms: lresult = False skip_vms.append(vm) if not no_post_provision: post_provision_compute_nodes(skip=skip, only=only, output=False, refresh=False, ret=ret) for a in chg.setdefault('postp_cns_in_error', []): if a not in skip: lresult = False skip.append(a) if not no_vms and not no_vms_post_provision: for compute_node in chg['cns_provisionned']: __salt__['mc_cloud_vm.post_provision_vms']( compute_node, output=False, skip=skip_vms, only=only_vms, refresh=False, ret=ret) vms_in_error = chg.setdefault('postp_vms_in_errors', {}) for node in vms_in_error: for vm in vms_in_error[node]: if vm not in skip_vms: skip_vms.append(vm) lresult = False ret['result'] = lresult salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret
def orchestrate(skip=None, skip_vms=None, only=None, only_vms=None, no_dns_conf=False, no_configure=False, no_saltify=False, no_provision=False, no_vms=False, no_compute_node_provision=False, no_post_provision=False, no_vms_post_provision=False, output=True, refresh=True, ret=None): '''install controller, compute node, vms & run postdeploy no_configure skip configuring the cloud controller skip list of compute nodes to skip skip_vms list of vm to skip only explicit list of compute nodes to deploy only_vms explicit list of vm to deploy no_provision skip compute node & vm provision no_compute_node_provision skip configuration of compute nodes no_vms do not provision vms no_post_provision do not post provision compute nodes no_vms_post_provision do not post provision vms ''' func_name = 'mc_cloud_controller.orchestrate' __salt__['mc_api.time_log']('start {0}'.format(func_name)) only, only_vms, skip, skip_vms = ( __salt__['mc_cloud_controller.gather_only_skip']( only=only, only_vms=only_vms, skip=skip, skip_vms=skip_vms)) if ret is None: ret = result() if refresh: cli('saltutil.refresh_pillar') cret = result() try: # only deploy base configuration if we did not set # a specific saltify/computenode/vm switch if not no_dns_conf: dns_conf(output=False, ret=cret) check_point(cret, __opts__, output=output) del cret['result'] merge_results(ret, cret) if not no_configure: cret = result() # test that all hosts resolve else # for the dns migration deploy(output=False, ret=cret) check_point(cret, __opts__, output=output) del cret['result'] merge_results(ret, cret) if not no_saltify: cret = result() __salt__['mc_cloud_saltify.orchestrate']( only=only, skip=skip, ret=cret, output=False, refresh=False) del cret['result'] merge_results(ret, cret) cn_in_error = cret['changes'].get('saltified_errors', []) if not no_provision: if not skip: skip = [] skip += cn_in_error cret = result() __salt__['mc_cloud_compute_node.orchestrate']( skip=skip, skip_vms=skip_vms, only=only, only_vms=only_vms, no_provision=no_provision, no_compute_node_provision=no_compute_node_provision, no_post_provision=no_post_provision, no_vms_post_provision=no_vms_post_provision, no_vms=no_vms, refresh=False, output=False, ret=cret) del cret['result'] merge_results(ret, cret) cn_in_error = cret['changes'].get('provision_error', []) except FailedStepError: merge_results(ret, cret) trace = traceback.format_exc() ret['output'] += '\n{0}'.format(trace) salt_output(ret, __opts__, output=output) raise salt_output(ret, __opts__, output=output) __salt__['mc_api.time_log']('end {0}'.format(func_name)) return ret