Backport/2.8/60105: turn off the default db warning where it doesn't make sense (#60107)

* Bugfix 60043: turn off the default db warning where it doesn't make sense (#60105)

(cherry picked from commit d2cc9f5f06)

* Backport of 60105: turn off the default db warning where it doesn't make sense
pull/60242/head
Andrey Klychkov 7 years ago committed by Toshio Kuratomi
parent 4f763037b0
commit 81a5183428

@ -0,0 +1,5 @@
bugfixes:
- postgresql_slot - turn off the default database warning for slot_type physical (https://github.com/ansible/ansible/issues/60043)
- postgresql_membership - turn off the default database warning (https://github.com/ansible/ansible/pull/60043)
- postgresql_ping - turn off the default database warning (https://github.com/ansible/ansible/pull/60043)
- postgresql_tablespace - turn off the default database warning (https://github.com/ansible/ansible/pull/60043)

@ -294,7 +294,7 @@ def main():
fail_on_role = module.params['fail_on_role']
state = module.params['state']
conn_params = get_conn_params(module, module.params)
conn_params = get_conn_params(module, module.params, warn_db_default=False)
db_connection = connect_to_db(module, conn_params, autocommit=False)
cursor = db_connection.cursor(cursor_factory=DictCursor)

@ -147,7 +147,7 @@ def main():
server_version=dict(),
)
conn_params = get_conn_params(module, module.params)
conn_params = get_conn_params(module, module.params, warn_db_default=False)
db_connection = connect_to_db(module, conn_params, fail_on_conn=False)
if db_connection is not None:

@ -255,7 +255,18 @@ def main():
if immediately_reserve and slot_type == 'logical':
module.fail_json(msg="Module parameters immediately_reserve and slot_type=logical are mutually exclusive")
conn_params = get_conn_params(module, module.params)
# When slot_type is logical and parameter db is not passed,
# the default database will be used to create the slot and
# the user should know about this.
# When the slot type is physical,
# it doesn't matter which database will be used
# because physical slots are global objects.
if slot_type == 'logical':
warn_db_default = True
else:
warn_db_default = False
conn_params = get_conn_params(module, module.params, warn_db_default=warn_db_default)
db_connection = connect_to_db(module, conn_params, autocommit=True)
cursor = db_connection.cursor(cursor_factory=DictCursor)

@ -346,7 +346,7 @@ def main():
module.fail_json(msg="state=absent is mutually exclusive location, "
"owner, rename_to, and set")
conn_params = get_conn_params(module, module.params)
conn_params = get_conn_params(module, module.params, warn_db_default=False)
db_connection = connect_to_db(module, conn_params, autocommit=True)
cursor = db_connection.cursor(cursor_factory=DictCursor)

Loading…
Cancel
Save