mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Raises "CommandExecutionError" if snapper command fails
This commit is contained in:
parent
3841e1143b
commit
edea45272a
1 changed files with 11 additions and 6 deletions
|
@ -550,16 +550,21 @@ def undo(config='root', files=None, num_pre=None, num_post=None):
|
|||
'Given file list contains files that are not present'
|
||||
'in the changed filelist: {0}'.format(changed - requested))
|
||||
|
||||
components = cmdret.split(' ')
|
||||
ret = {}
|
||||
for comp in components:
|
||||
key, val = comp.split(':')
|
||||
ret[key] = val
|
||||
return ret
|
||||
|
||||
cmdret = __salt__['cmd.run']('snapper -c {0} undochange {1}..{2} {3}'.format(
|
||||
config, pre, post, ' '.join(requested)))
|
||||
|
||||
try:
|
||||
components = cmdret.split(' ')
|
||||
ret = {}
|
||||
for comp in components:
|
||||
key, val = comp.split(':')
|
||||
ret[key] = val
|
||||
return ret
|
||||
except ValueError as exc:
|
||||
raise CommandExecutionError(
|
||||
'Error while processing Snapper response: {}'.format(cmdret))
|
||||
|
||||
|
||||
def _get_jid_snapshots(jid, config='root'):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue