Fixed postgresql_db failing on Python 2.4 with --check
This reverts commit 81cbdb6c8c
and adds ignoring of the SystemExit exception because of Python 2.4.
This commit is contained in:
parent
81cbdb6c8c
commit
07b98c45df
1 changed files with 10 additions and 6 deletions
|
@ -281,15 +281,19 @@ def main():
|
|||
elif state == "present":
|
||||
changed = not db_matches(cursor, db, owner, template, encoding,
|
||||
lc_collate, lc_ctype)
|
||||
else:
|
||||
if state == "absent":
|
||||
changed = db_delete(cursor, db)
|
||||
module.exit_json(changed=changed,db=db)
|
||||
|
||||
elif state == "present":
|
||||
changed = db_create(cursor, db, owner, template, encoding,
|
||||
lc_collate, lc_ctype)
|
||||
if state == "absent":
|
||||
changed = db_delete(cursor, db)
|
||||
|
||||
elif state == "present":
|
||||
changed = db_create(cursor, db, owner, template, encoding,
|
||||
lc_collate, lc_ctype)
|
||||
except NotSupportedError, e:
|
||||
module.fail_json(msg=str(e))
|
||||
except SystemExit:
|
||||
# Avoid catching this on Python 2.4
|
||||
raise
|
||||
except Exception, e:
|
||||
module.fail_json(msg="Database query failed: %s" % e)
|
||||
|
||||
|
|
Loading…
Reference in a new issue