mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Suppress error about invalid changes data for orchestration jobs
This commit is contained in:
parent
54a1704d6c
commit
7b8c3b86e7
1 changed files with 27 additions and 15 deletions
|
@ -188,7 +188,8 @@ def _format_host(host, data):
|
|||
.format(ret.get('duration', 0)))
|
||||
|
||||
tcolor = colors['GREEN']
|
||||
schanged, ctext = _format_changes(ret['changes'])
|
||||
orchestration = ret.get('__orchestration__', False)
|
||||
schanged, ctext = _format_changes(ret['changes'], orchestration)
|
||||
nchanges += 1 if schanged else 0
|
||||
|
||||
# Skip this state if it was successful & diff output was requested
|
||||
|
@ -441,15 +442,37 @@ def _format_host(host, data):
|
|||
return u'\n'.join(hstrs), nchanges > 0
|
||||
|
||||
|
||||
def _format_changes(changes):
|
||||
def _nested_changes(changes):
|
||||
'''
|
||||
Format the changes dict based on what the data is
|
||||
Print the changes data using the nested outputter
|
||||
'''
|
||||
global __opts__ # pylint: disable=W0601
|
||||
|
||||
opts = __opts__.copy()
|
||||
# Pass the __opts__ dict. The loader will splat this modules __opts__ dict
|
||||
# anyway so have to restore it after the other outputter is done
|
||||
if __opts__['color']:
|
||||
__opts__['color'] = u'CYAN'
|
||||
__opts__['nested_indent'] = 14
|
||||
ret = u'\n'
|
||||
ret += salt.output.out_format(
|
||||
changes,
|
||||
'nested',
|
||||
__opts__)
|
||||
__opts__ = opts
|
||||
return ret
|
||||
|
||||
|
||||
def _format_changes(changes, orchestration=False):
|
||||
'''
|
||||
Format the changes dict based on what the data is
|
||||
'''
|
||||
if not changes:
|
||||
return False, u''
|
||||
|
||||
if orchestration:
|
||||
return True, _nested_changes(changes)
|
||||
|
||||
if not isinstance(changes, dict):
|
||||
return True, u'Invalid Changes data: {0}'.format(changes)
|
||||
|
||||
|
@ -463,18 +486,7 @@ def _format_changes(changes):
|
|||
changed = changed or c
|
||||
else:
|
||||
changed = True
|
||||
opts = __opts__.copy()
|
||||
# Pass the __opts__ dict. The loader will splat this modules __opts__ dict
|
||||
# anyway so have to restore it after the other outputter is done
|
||||
if __opts__['color']:
|
||||
__opts__['color'] = u'CYAN'
|
||||
__opts__['nested_indent'] = 14
|
||||
ctext = u'\n'
|
||||
ctext += salt.output.out_format(
|
||||
changes,
|
||||
'nested',
|
||||
__opts__)
|
||||
__opts__ = opts
|
||||
ctext = _nested_changes(changes)
|
||||
return changed, ctext
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue