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.
reviewable/pr18780/r1
kustodian 10 years ago
parent 81cbdb6c8c
commit 07b98c45df

@ -281,7 +281,8 @@ 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": if state == "absent":
changed = db_delete(cursor, db) changed = db_delete(cursor, db)
@ -290,6 +291,9 @@ def main():
lc_collate, lc_ctype) 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…
Cancel
Save