mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make postgresql module in extras compile on py3
This commit is contained in:
parent
6963cd8ae7
commit
95929fb79f
3 changed files with 10 additions and 6 deletions
|
@ -159,7 +159,8 @@ def main():
|
||||||
.ISOLATION_LEVEL_AUTOCOMMIT)
|
.ISOLATION_LEVEL_AUTOCOMMIT)
|
||||||
cursor = db_connection.cursor(
|
cursor = db_connection.cursor(
|
||||||
cursor_factory=psycopg2.extras.DictCursor)
|
cursor_factory=psycopg2.extras.DictCursor)
|
||||||
except Exception, e:
|
except Exception:
|
||||||
|
e = get_exception()
|
||||||
module.fail_json(msg="unable to connect to database: %s" % e)
|
module.fail_json(msg="unable to connect to database: %s" % e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -174,14 +175,17 @@ def main():
|
||||||
|
|
||||||
elif state == "present":
|
elif state == "present":
|
||||||
changed = ext_create(cursor, ext)
|
changed = ext_create(cursor, ext)
|
||||||
except NotSupportedError, e:
|
except NotSupportedError:
|
||||||
|
e = get_exception()
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
except Exception, e:
|
except Exception:
|
||||||
|
e = get_exception()
|
||||||
module.fail_json(msg="Database query failed: %s" % e)
|
module.fail_json(msg="Database query failed: %s" % e)
|
||||||
|
|
||||||
module.exit_json(changed=changed, db=db, ext=ext)
|
module.exit_json(changed=changed, db=db, ext=ext)
|
||||||
|
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
|
from ansible.module_utils.pycompat24 import get_exception
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,8 @@ def main():
|
||||||
try:
|
try:
|
||||||
db_connection = psycopg2.connect(**kw)
|
db_connection = psycopg2.connect(**kw)
|
||||||
cursor = db_connection.cursor()
|
cursor = db_connection.cursor()
|
||||||
except Exception, e:
|
except Exception:
|
||||||
|
e = get_exception()
|
||||||
module.fail_json(msg="unable to connect to database: %s" % e)
|
module.fail_json(msg="unable to connect to database: %s" % e)
|
||||||
changed = False
|
changed = False
|
||||||
lang_dropped = False
|
lang_dropped = False
|
||||||
|
@ -267,4 +268,5 @@ def main():
|
||||||
|
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
|
from ansible.module_utils.pycompat24 import get_exception
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
/clustering/consul_kv.py
|
/clustering/consul_kv.py
|
||||||
/clustering/consul_session.py
|
/clustering/consul_session.py
|
||||||
/database/mysql/mysql_replication.py
|
/database/mysql/mysql_replication.py
|
||||||
/database/postgresql/postgresql_ext.py
|
|
||||||
/database/postgresql/postgresql_lang.py
|
|
||||||
/database/vertica/vertica_configuration.py
|
/database/vertica/vertica_configuration.py
|
||||||
/database/vertica/vertica_facts.py
|
/database/vertica/vertica_facts.py
|
||||||
/database/vertica/vertica_role.py
|
/database/vertica/vertica_role.py
|
||||||
|
|
Loading…
Reference in a new issue