def over(env='base', os_fn=None): ''' Execute an overstate sequence to orchestrate the executing of states over a group of systems ''' stage_num = 0 overstate = salt.overstate.OverState(__opts__, env, os_fn) for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data print('Stage execution results:') for key, val in stage.items(): if '_|-' in key: salt.output.display_output( {'error': {key: val}}, 'highstate', opts=__opts__) else: salt.output.display_output( {key: val}, 'highstate', opts=__opts__) elif isinstance(stage, list): # This is a stage if stage_num == 0: print('Executing the following Over State:') else: print('Executed Stage:') salt.output.display_output(stage, 'overstatestage', opts=__opts__) stage_num += 1 return overstate.over_run
def over(env='base', os_fn=None): ''' Execute an overstate sequence to orchestrate the executing of states over a group of systems ''' stage_num = 0 overstate = salt.overstate.OverState(__opts__, env, os_fn) for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data print('Stage execution results:') for key, val in stage.items(): if '_|-' in key: salt.output.display_output({'error': { key: val }}, 'highstate', opts=__opts__) else: salt.output.display_output({key: val}, 'highstate', opts=__opts__) elif isinstance(stage, list): # This is a stage if stage_num == 0: print('Executing the following Over State:') else: print('Executed Stage:') salt.output.display_output(stage, 'overstatestage', opts=__opts__) stage_num += 1 return overstate.over_run
def orchestrate(saltenv='base', os_fn=None): """ Borrowed and adpated from salt.runners.state::over() Modifying this to return a generator instead of all the data at once CLI Examples: .. code-block:: bash salt-run stackdio.orchestrate <env> </path/to/orchestration.file> """ try: overstate = StackdioOverState(__opts__, saltenv, os_fn) except IOError as exc: raise SaltInvocationError( '{0}: {1!r}'.format(exc.strerror, exc.filename) ) # ret = {} for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data yield stage # for host, result in stage.items(): # if '_|-' in host: # ret.setdefault('__stage__error__', []).append(result) # else: # ret.setdefault(host, []).append(result) elif isinstance(stage, list): # we don't care about output from stage executions continue
def over(saltenv='base', os_fn=None): ''' .. versionadded:: 0.11.0 .. warning:: ``state.over`` is deprecated in favor of ``state.orchestrate``, and will be removed in the Salt feature release codenamed Boron. (Three feature releases after the 2014.7.0 release, which is codenamed Helium) Execute an overstate sequence to orchestrate the executing of states over a group of systems CLI Examples: .. code-block:: bash salt-run state.over base /path/to/myoverstate.sls ''' salt.utils.warn_until( 'Boron', 'The state.over runner is on a deprecation path and will be ' 'removed in Salt Boron. Please migrate to state.orchestrate.' ) stage_num = 0 try: overstate = salt.overstate.OverState(__opts__, saltenv, os_fn) except IOError as exc: raise SaltInvocationError( '{0}: {1!r}'.format(exc.strerror, exc.filename) ) for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data print('Stage execution results:') for key, val in stage.items(): if '_|-' in key: salt.output.display_output( {'error': {key: val}}, 'highstate', opts=__opts__) else: salt.output.display_output( {key: val}, 'highstate', opts=__opts__) elif isinstance(stage, list): # This is a stage if stage_num == 0: print('Executing the following Over State:') else: print('Executed Stage:') salt.output.display_output(stage, 'overstatestage', opts=__opts__) stage_num += 1 return overstate.over_run
def over(saltenv='base', os_fn=None): ''' .. versionadded:: 0.11.0 .. warning:: ``state.over`` is deprecated in favor of ``state.orchestrate``, and will be removed in the Salt feature release codenamed Boron. (Three feature releases after the 2014.7.0 release, which is codenamed Helium) Execute an overstate sequence to orchestrate the executing of states over a group of systems CLI Examples: .. code-block:: bash salt-run state.over base /path/to/myoverstate.sls ''' salt.utils.warn_until( 'Boron', 'The state.over runner is on a deprecation path and will be ' 'removed in Salt Boron. Please migrate to state.orchestrate.' ) stage_num = 0 try: overstate = salt.overstate.OverState(__opts__, saltenv, os_fn) except IOError as exc: raise SaltInvocationError( '{0}: {1!r}'.format(exc.strerror, exc.filename) ) for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data __jid_event__.fire_event({'message': 'Stage execution results:'}, 'progress') for key, val in six.iteritems(stage): if '_|-' in key: __jid_event__.fire_event({'data': {'error': {key: val}}, 'outputter': 'highstate'}, 'progress') else: __jid_event__.fire_event({'data': {key: val}, 'outputter': 'highstate'}, 'progress') elif isinstance(stage, list): # This is a stage if stage_num == 0: __jid_event__.fire_event({'message': 'Executing the following Over State:'}, 'progress') else: __jid_event__.fire_event({'message': 'Executed Stage:'}, 'progress') __jid_event__.fire_event({'data': stage, 'outputter': 'overstatestage'}, 'progress') stage_num += 1 return overstate.over_run
def over(env='base', os_fn=None): ''' Execute an overstate sequence to orchestrate the executing of states over a group of systems ''' overstate = salt.overstate.OverState(__opts__, env, os_fn) for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data for key, val in stage.items(): salt.output.display_output( {key: val}, 'highstate', opts=__opts__) elif isinstance(stage, list): # This is a stage salt.output.display_output(stage, 'overstatestage', opts=__opts__) return overstate.over_run
def over(saltenv='base', os_fn=None): ''' .. versionadded:: 0.11.0 Execute an overstate sequence to orchestrate the executing of states over a group of systems CLI Examples: .. code-block:: bash salt-run state.over base /path/to/myoverstate.sls ''' stage_num = 0 try: overstate = salt.overstate.OverState(__opts__, saltenv, os_fn) except IOError as exc: raise SaltInvocationError( '{0}: {1!r}'.format(exc.strerror, exc.filename) ) for stage in overstate.stages_iter(): if isinstance(stage, dict): # This is highstate data print('Stage execution results:') for key, val in stage.items(): if '_|-' in key: salt.output.display_output( {'error': {key: val}}, 'highstate', opts=__opts__) else: salt.output.display_output( {key: val}, 'highstate', opts=__opts__) elif isinstance(stage, list): # This is a stage if stage_num == 0: print('Executing the following Over State:') else: print('Executed Stage:') salt.output.display_output(stage, 'overstatestage', opts=__opts__) stage_num += 1 return overstate.over_run