vertica_facts: rename to vertica_info (#60916)

* Rename vertica_facts -> vertica_info

* Add changelog.

* Fix porting guide.
This commit is contained in:
Felix Fontein 2019-08-27 21:28:36 +02:00 committed by GitHub
parent 0696fcacf0
commit 1906c05348
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 10 deletions

View file

@ -0,0 +1,3 @@
minor_changes:
- The ``vertica_facts`` module has been renamed to ``vertica_info``.
When called with the new name, the module no longer returns ``ansible_facts``.

View file

@ -435,6 +435,9 @@ be removed in Ansible 2.13. Please update update your playbooks accordingly.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``redshift_facts`` module was renamed to :ref:`redshift_info <redshift_info_module>`.
* The ``route53_facts`` module was renamed to :ref:`route53_info <route53_info_module>`.
* The ``vertica_facts`` module was renamed to :ref:`vertica_info <vertica_info_module>`.
When called with the new name, the module no longer returns ``ansible_facts``.
To access return values, :ref:`register a variable <registered_variables>`.
* The ``vmware_cluster_facts`` module was renamed to :ref:`vmware_cluster_info <vmware_cluster_info_module>`.
* The ``vmware_datastore_facts`` module was renamed to :ref:`vmware_datastore_info <vmware_datastore_info_module>`.
* The ``vmware_guest_facts`` module was renamed to :ref:`vmware_guest_info <vmware_guest_info_module>`.

View file

@ -0,0 +1 @@
vertica_info.py

View file

@ -15,11 +15,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: vertica_facts
module: vertica_info
version_added: '2.0'
short_description: Gathers Vertica database facts.
description:
- Gathers Vertica database facts.
- Gathers Vertica database information.
- This module was called C(vertica_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(vertica_info) module no longer returns C(ansible_facts)!
options:
cluster:
description:
@ -54,7 +56,12 @@ author: "Dariusz Owczarek (@dareko)"
EXAMPLES = """
- name: gathering vertica facts
vertica_facts: db=db_name
vertica_info: db=db_name
register: result
- name: Print schemas
debug:
msg: "{{ result.vertica_schemas }}"
"""
import traceback
@ -227,6 +234,10 @@ def main():
login_user=dict(default='dbadmin'),
login_password=dict(default=None, no_log=True),
), supports_check_mode=True)
is_old_facts = module._name == 'vertica_facts'
if is_old_facts:
module.deprecate("The 'vertica_facts' module has been renamed to 'vertica_info', "
"and the renamed one no longer returns ansible_facts", version='2.13')
if not pyodbc_found:
module.fail_json(msg=missing_required_lib('pyodbc'), exception=PYODBC_IMP_ERR)
@ -257,12 +268,21 @@ def main():
role_facts = get_role_facts(cursor)
configuration_facts = get_configuration_facts(cursor)
node_facts = get_node_facts(cursor)
module.exit_json(changed=False,
ansible_facts={'vertica_schemas': schema_facts,
'vertica_users': user_facts,
'vertica_roles': role_facts,
'vertica_configuration': configuration_facts,
'vertica_nodes': node_facts})
if is_old_facts:
module.exit_json(changed=False,
ansible_facts={'vertica_schemas': schema_facts,
'vertica_users': user_facts,
'vertica_roles': role_facts,
'vertica_configuration': configuration_facts,
'vertica_nodes': node_facts})
else:
module.exit_json(changed=False,
vertica_schemas=schema_facts,
vertica_users=user_facts,
vertica_roles=role_facts,
vertica_configuration=configuration_facts,
vertica_nodes=node_facts)
except NotSupportedError as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
except SystemExit:

View file

@ -2247,7 +2247,7 @@ lib/ansible/modules/database/proxysql/proxysql_scheduler.py validate-modules:E32
lib/ansible/modules/database/proxysql/proxysql_scheduler.py validate-modules:E337
lib/ansible/modules/database/proxysql/proxysql_scheduler.py validate-modules:E338
lib/ansible/modules/database/vertica/vertica_configuration.py validate-modules:E338
lib/ansible/modules/database/vertica/vertica_facts.py validate-modules:E338
lib/ansible/modules/database/vertica/vertica_info.py validate-modules:E338
lib/ansible/modules/database/vertica/vertica_role.py validate-modules:E322
lib/ansible/modules/database/vertica/vertica_role.py validate-modules:E338
lib/ansible/modules/database/vertica/vertica_schema.py validate-modules:E322