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":
|
elif state == "present":
|
||||||
changed = not db_matches(cursor, db, owner, template, encoding,
|
changed = not db_matches(cursor, db, owner, template, encoding,
|
||||||
lc_collate, lc_ctype)
|
lc_collate, lc_ctype)
|
||||||
else:
|
module.exit_json(changed=changed,db=db)
|
||||||
if state == "absent":
|
|
||||||
changed = db_delete(cursor, db)
|
|
||||||
|
|
||||||
elif state == "present":
|
if state == "absent":
|
||||||
changed = db_create(cursor, db, owner, template, encoding,
|
changed = db_delete(cursor, db)
|
||||||
lc_collate, lc_ctype)
|
|
||||||
|
elif state == "present":
|
||||||
|
changed = db_create(cursor, db, owner, template, encoding,
|
||||||
|
lc_collate, lc_ctype)
|
||||||
except NotSupportedError, e:
|
except NotSupportedError, e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
except SystemExit:
|
||||||
|
# Avoid catching this on Python 2.4
|
||||||
|
raise
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
module.fail_json(msg="Database query failed: %s" % e)
|
module.fail_json(msg="Database query failed: %s" % e)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue