From e58919bccd86dc3be6886d370330726f0d985e6b Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 20 Aug 2019 15:43:41 +0200 Subject: [PATCH] gluster_heal_facts: rename to gluster_heal_info (#60919) * Rename gluster_heal_facts -> gluster_heal_info * Add changelog. --- .../60919-gluster_heal_facts-info-rename.yml | 3 +++ .../rst/porting_guides/porting_guide_2.9.rst | 3 +++ .../storage/glusterfs/_gluster_heal_facts.py | 1 + ...ter_heal_facts.py => gluster_heal_info.py} | 19 ++++++++++++++----- test/sanity/ignore.txt | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/60919-gluster_heal_facts-info-rename.yml create mode 120000 lib/ansible/modules/storage/glusterfs/_gluster_heal_facts.py rename lib/ansible/modules/storage/glusterfs/{gluster_heal_facts.py => gluster_heal_info.py} (89%) diff --git a/changelogs/fragments/60919-gluster_heal_facts-info-rename.yml b/changelogs/fragments/60919-gluster_heal_facts-info-rename.yml new file mode 100644 index 00000000000..f40b4f08d0a --- /dev/null +++ b/changelogs/fragments/60919-gluster_heal_facts-info-rename.yml @@ -0,0 +1,3 @@ +minor_changes: +- The ``gluster_heal_facts`` module has been renamed to ``gluster_heal_info``. + When called with the new name, the module no longer returns ``ansible_facts``. diff --git a/docs/docsite/rst/porting_guides/porting_guide_2.9.rst b/docs/docsite/rst/porting_guides/porting_guide_2.9.rst index e5b38523abb..7702e61b1ad 100644 --- a/docs/docsite/rst/porting_guides/porting_guide_2.9.rst +++ b/docs/docsite/rst/porting_guides/porting_guide_2.9.rst @@ -239,6 +239,9 @@ be removed in Ansible 2.13. Please update update your playbooks accordingly. * The ``gcp_tpu_node_facts`` module was renamed to :ref:`gcp_tpu_node_info `. * The ``gcpubsub_facts`` module was renamed to :ref:`gcpubsub_info `. * The ``github_webhook_facts`` module was renamed to :ref:`github_webhook_info `. +* The ``gluster_heal_facts`` module was renamed to :ref:`gluster_heal_info `. + When called with the new name, the module no longer returns ``ansible_facts``. + To access return values, :ref:`register a variable `. * The ``hpilo_facts`` module was renamed to :ref:`hpilo_info `. When called with the new name, the module no longer returns ``ansible_facts``. To access return values, :ref:`register a variable `. diff --git a/lib/ansible/modules/storage/glusterfs/_gluster_heal_facts.py b/lib/ansible/modules/storage/glusterfs/_gluster_heal_facts.py new file mode 120000 index 00000000000..e5a7565c18c --- /dev/null +++ b/lib/ansible/modules/storage/glusterfs/_gluster_heal_facts.py @@ -0,0 +1 @@ +gluster_heal_info.py \ No newline at end of file diff --git a/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py b/lib/ansible/modules/storage/glusterfs/gluster_heal_info.py similarity index 89% rename from lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py rename to lib/ansible/modules/storage/glusterfs/gluster_heal_info.py index 0f3be996ff6..4af8eb95fbc 100644 --- a/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py +++ b/lib/ansible/modules/storage/glusterfs/gluster_heal_info.py @@ -14,12 +14,14 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- -module: gluster_heal_facts -short_description: Gather facts about self-heal or rebalance status +module: gluster_heal_info +short_description: Gather information on self-heal or rebalance status author: "Devyani Kota (@devyanikota)" version_added: "2.8" description: - Gather facts about either self-heal or rebalance status. + - This module was called C(gluster_heal_facts) before Ansible 2.9, returning C(ansible_facts). + Note that the M(gluster_heal_info) module no longer returns C(ansible_facts)! options: name: description: @@ -39,7 +41,7 @@ requirements: EXAMPLES = ''' - name: Gather self-heal facts about all gluster hosts in the cluster - gluster_heal_facts: + gluster_heal_info: name: test_volume status_filter: self-heal register: self_heal_status @@ -47,7 +49,7 @@ EXAMPLES = ''' var: self_heal_status - name: Gather rebalance facts about all gluster hosts in the cluster - gluster_heal_facts: + gluster_heal_info: name: test_volume status_filter: rebalance register: rebalance_status @@ -164,6 +166,10 @@ def main(): status_filter=dict(type='str', default='self-heal', choices=['self-heal', 'rebalance']), ), ) + is_old_facts = module._name == 'gluster_heal_facts' + if is_old_facts: + module.deprecate("The 'gluster_heal_facts' module has been renamed to 'gluster_heal_info', " + "and the renamed one no longer returns ansible_facts", version='2.13') glusterbin = module.get_bin_path('gluster', True) required_version = "3.2" @@ -188,7 +194,10 @@ def main(): facts = {} facts['glusterfs'] = {'volume': volume_name, 'status_filter': status_filter, 'heal_info': heal_info, 'rebalance': rebalance_status} - module.exit_json(ansible_facts=facts) + if is_old_facts: + module.exit_json(ansible_facts=facts) + else: + module.exit_json(**facts) if __name__ == '__main__': diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index d2190f09e32..ecb97447214 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -5484,7 +5484,7 @@ lib/ansible/modules/source_control/subversion.py validate-modules:E322 lib/ansible/modules/source_control/subversion.py validate-modules:E337 lib/ansible/modules/storage/emc/emc_vnx_sg_member.py validate-modules:E337 lib/ansible/modules/storage/emc/emc_vnx_sg_member.py validate-modules:E338 -lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py validate-modules:E337 +lib/ansible/modules/storage/glusterfs/gluster_heal_info.py validate-modules:E337 lib/ansible/modules/storage/glusterfs/gluster_peer.py validate-modules:E337 lib/ansible/modules/storage/glusterfs/gluster_volume.py validate-modules:E337 lib/ansible/modules/storage/ibm/ibm_sa_domain.py validate-modules:E338