mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
handle psql error
This commit is contained in:
parent
7f673796e6
commit
4e34081bb4
@ -282,7 +282,11 @@ def user_exists(name, user=None, host=None, port=None, runas=None):
|
||||
cmd = _psql_cmd('-c', query, host=host, user=user, port=port)
|
||||
cmdret = __salt__['cmd.run'](cmd, runas=runas)
|
||||
log.debug(cmdret.splitlines())
|
||||
val = cmdret.splitlines()[1]
|
||||
try:
|
||||
val = cmdret.splitlines()[1]
|
||||
except IndexError:
|
||||
log.error("Invalid PostgreSQL result: '%s'", cmdret)
|
||||
return False
|
||||
return True if val.strip() == 't' else False
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user