1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #1003 from bladypirat/devel

added support for custom port definition for postgresql_* modules
This commit is contained in:
Michael DeHaan 2012-09-06 17:51:35 -07:00
commit 7ef3e7dccb
2 changed files with 7 additions and 1 deletions

View file

@ -77,6 +77,7 @@ def main():
login_user=dict(default="postgres"), login_user=dict(default="postgres"),
login_password=dict(default=""), login_password=dict(default=""),
login_host=dict(default=""), login_host=dict(default=""),
port=dict(default="5432"),
db=dict(required=True, aliases=['name']), db=dict(required=True, aliases=['name']),
owner=dict(default=""), owner=dict(default=""),
template=dict(default=""), template=dict(default=""),
@ -89,6 +90,7 @@ def main():
module.fail_json(msg="the python psycopg2 module is required") module.fail_json(msg="the python psycopg2 module is required")
db = module.params["db"] db = module.params["db"]
port = module.params["port"]
owner = module.params["owner"] owner = module.params["owner"]
template = module.params["template"] template = module.params["template"]
encoding = module.params["encoding"] encoding = module.params["encoding"]
@ -101,7 +103,8 @@ def main():
params_map = { params_map = {
"login_host":"host", "login_host":"host",
"login_user":"user", "login_user":"user",
"login_password":"password" "login_password":"password",
"port":"port"
} }
kw = dict( (params_map[k], v) for (k, v) in module.params.iteritems() kw = dict( (params_map[k], v) for (k, v) in module.params.iteritems()
if k in params_map and v != '' ) if k in params_map and v != '' )

View file

@ -224,6 +224,7 @@ def main():
state=dict(default="present", choices=["absent", "present"]), state=dict(default="present", choices=["absent", "present"]),
priv=dict(default=None), priv=dict(default=None),
db=dict(default=''), db=dict(default=''),
port=dict(default='5432'),
fail_on_user=dict(default='yes') fail_on_user=dict(default='yes')
) )
) )
@ -235,6 +236,7 @@ def main():
if db == '' and module.params["priv"] is not None: if db == '' and module.params["priv"] is not None:
module.fail_json(msg="privileges require a database to be specified") module.fail_json(msg="privileges require a database to be specified")
privs = parse_privs(module.params["priv"], db) privs = parse_privs(module.params["priv"], db)
port = module.params["port"]
if not postgresqldb_found: if not postgresqldb_found:
module.fail_json(msg="the python psycopg2 module is required") module.fail_json(msg="the python psycopg2 module is required")
@ -246,6 +248,7 @@ def main():
"login_host":"host", "login_host":"host",
"login_user":"user", "login_user":"user",
"login_password":"password", "login_password":"password",
"port":"port",
"db":"database" "db":"database"
} }
kw = dict( (params_map[k], v) for (k, v) in module.params.iteritems() kw = dict( (params_map[k], v) for (k, v) in module.params.iteritems()