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:
jfindlay 2015-03-24 13:11:50 -06:00
commit 40b99a2a11

View File

@ -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):