mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #44244 from cloudflare/add-retcode
Add explicit non-zero retcode to napalm config functions
This commit is contained in:
commit
c849f350ba
@ -153,6 +153,7 @@ def _config_logic(napalm_device,
|
||||
loaded_result['diff'] = None
|
||||
loaded_result['result'] = False
|
||||
loaded_result['comment'] = _compare.get('comment')
|
||||
__context__['retcode'] = 1
|
||||
return loaded_result
|
||||
|
||||
_loaded_res = loaded_result.get('result', False)
|
||||
@ -172,12 +173,15 @@ def _config_logic(napalm_device,
|
||||
# make sure it notifies
|
||||
# that something went wrong
|
||||
_explicit_close(napalm_device)
|
||||
__context__['retcode'] = 1
|
||||
return loaded_result
|
||||
|
||||
loaded_result['comment'] += 'Configuration discarded.'
|
||||
# loaded_result['result'] = False not necessary
|
||||
# as the result can be true when test=True
|
||||
_explicit_close(napalm_device)
|
||||
if not loaded_result['result']:
|
||||
__context__['retcode'] = 1
|
||||
return loaded_result
|
||||
|
||||
if not test and commit_config:
|
||||
@ -208,10 +212,13 @@ def _config_logic(napalm_device,
|
||||
loaded_result['result'] = False
|
||||
# notify if anything goes wrong
|
||||
_explicit_close(napalm_device)
|
||||
__context__['retcode'] = 1
|
||||
return loaded_result
|
||||
loaded_result['already_configured'] = True
|
||||
loaded_result['comment'] = 'Already configured.'
|
||||
_explicit_close(napalm_device)
|
||||
if not loaded_result['result']:
|
||||
__context__['retcode'] = 1
|
||||
return loaded_result
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user