summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/database/postgresql/postgresql_ext.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/modules/database/postgresql/postgresql_ext.py')
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_ext.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/ansible/modules/database/postgresql/postgresql_ext.py b/lib/ansible/modules/database/postgresql/postgresql_ext.py
index f0e83fb148..97bd549f21 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_ext.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_ext.py
@@ -99,6 +99,7 @@ def ext_exists(cursor, ext):
cursor.execute(query, {'ext': ext})
return cursor.rowcount == 1
+
def ext_delete(cursor, ext):
if ext_exists(cursor, ext):
query = "DROP EXTENSION \"%s\"" % ext
@@ -107,6 +108,7 @@ def ext_delete(cursor, ext):
else:
return False
+
def ext_create(cursor, ext):
if not ext_exists(cursor, ext):
query = 'CREATE EXTENSION "%s"' % ext
@@ -119,6 +121,7 @@ def ext_create(cursor, ext):
# Module execution.
#
+
def main():
module = AnsibleModule(
argument_spec=dict(
@@ -130,7 +133,7 @@ def main():
ext=dict(required=True, aliases=['name']),
state=dict(default="present", choices=["absent", "present"]),
),
- supports_check_mode = True
+ supports_check_mode=True
)
if not postgresqldb_found:
@@ -145,13 +148,13 @@ def main():
# check which values are empty and don't include in the **kw
# dictionary
params_map = {
- "login_host":"host",
- "login_user":"user",
- "login_password":"password",
- "port":"port"
+ "login_host": "host",
+ "login_user": "user",
+ "login_password": "password",
+ "port": "port"
}
- kw = dict( (params_map[k], v) for (k, v) in module.params.items()
- if k in params_map and v != '' )
+ kw = dict((params_map[k], v) for (k, v) in module.params.items()
+ if k in params_map and v != '')
try:
db_connection = psycopg2.connect(database=db, **kw)
# Enable autocommit so we can create databases