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,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…
Cancel
Save