mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #21947 from dmyerscough/20625-Fixing-invalid-syntax
Ensure nginx config check passes by checking the exit status
This commit is contained in:
commit
40b99a2a11
@ -55,11 +55,23 @@ def configtest():
|
||||
|
||||
salt '*' nginx.configtest
|
||||
'''
|
||||
ret = {}
|
||||
|
||||
cmd = '{0} -t'.format(__detect_os())
|
||||
out = __salt__['cmd.run'](cmd).splitlines()
|
||||
ret = out[0].split(': ')
|
||||
return ret[-1]
|
||||
out = __salt__['cmd.run_all'](cmd)
|
||||
|
||||
if out['retcode'] != 0:
|
||||
ret['comment'] = 'Syntax Error'
|
||||
ret['stderr'] = out['stderr']
|
||||
ret['result'] = False
|
||||
|
||||
return ret
|
||||
|
||||
ret['comment'] = 'Syntax OK'
|
||||
ret['stdout'] = out['stderr']
|
||||
ret['result'] = True
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def signal(signal=None):
|
||||
|
Loading…
Reference in New Issue
Block a user