summaryrefslogtreecommitdiff
path: root/database/postgresql/postgresql_ext.py
diff options
context:
space:
mode:
authorMichael Scherer <misc@zarb.org>2016-10-16 16:57:57 +0200
committerToshio Kuratomi <a.badger@gmail.com>2016-10-17 13:14:02 -0700
commitf2ce143609d8eb2af9b3d8f6f89f7dd4ea68eb22 (patch)
treed863ddb33e5c004b1620964ae10413b5a5e7560a /database/postgresql/postgresql_ext.py
parent4c6247c661eb6bb979829e176fabdaf02b23881d (diff)
downloadansible-modules-extras-f2ce143609d8eb2af9b3d8f6f89f7dd4ea68eb22.tar.gz
Make postgresql module in extras compile on py3
Diffstat (limited to 'database/postgresql/postgresql_ext.py')
-rw-r--r--database/postgresql/postgresql_ext.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/database/postgresql/postgresql_ext.py b/database/postgresql/postgresql_ext.py
index f9b0d957..39c74afb 100644
--- a/database/postgresql/postgresql_ext.py
+++ b/database/postgresql/postgresql_ext.py
@@ -159,7 +159,8 @@ def main():
.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = db_connection.cursor(
cursor_factory=psycopg2.extras.DictCursor)
- except Exception, e:
+ except Exception:
+ e = get_exception()
module.fail_json(msg="unable to connect to database: %s" % e)
try:
@@ -174,14 +175,17 @@ def main():
elif state == "present":
changed = ext_create(cursor, ext)
- except NotSupportedError, e:
+ except NotSupportedError:
+ e = get_exception()
module.fail_json(msg=str(e))
- except Exception, e:
+ except Exception:
+ e = get_exception()
module.fail_json(msg="Database query failed: %s" % e)
module.exit_json(changed=changed, db=db, ext=ext)
# import module snippets
from ansible.module_utils.basic import *
+from ansible.module_utils.pycompat24 import get_exception
main()