Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudStack modules: rename _facts -> _info #61090

Merged
merged 17 commits into from Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/61090-cloudstack-facts-info.yaml
@@ -0,0 +1,3 @@
minor_changes:
- The ``cs_instance_facts`` module has been deprecated. Use ``cs_instance_info`` instead.
- The ``cs_zone_facts`` module has been deprecated. Use ``cs_zone_info`` instead.
4 changes: 4 additions & 0 deletions docs/docsite/rst/porting_guides/porting_guide_2.9.rst
Expand Up @@ -117,6 +117,10 @@ Deprecation notices

The following modules will be removed in Ansible 2.13. Please update update your playbooks accordingly.

* cs_instance_facts use :ref:`cs_instance_info <cs_instance_info_module>` instead.

* cs_zone_facts use :ref:`cs_zone_info <cs_zone_info_module>` instead.

* digital_ocean_sshkey_facts use :ref:`digital_ocean_sshkey_info <digital_ocean_sshkey_info_module>` instead.

* junos_interface use :ref:`junos_interfaces <junos_interfaces_module>` instead.
Expand Down
15 changes: 10 additions & 5 deletions lib/ansible/module_utils/cloudstack.py
Expand Up @@ -628,22 +628,27 @@ def poll_job(self, job=None, key=None):
time.sleep(2)
return job

def get_result(self, resource):
def update_result(self, resource, result=None):
if result is None:
result = dict()
if resource:
returns = self.common_returns.copy()
returns.update(self.returns)
for search_key, return_key in returns.items():
if search_key in resource:
self.result[return_key] = resource[search_key]
result[return_key] = resource[search_key]

# Bad bad API does not always return int when it should.
for search_key, return_key in self.returns_to_int.items():
if search_key in resource:
self.result[return_key] = int(resource[search_key])
result[return_key] = int(resource[search_key])

if 'tags' in resource:
self.result['tags'] = resource['tags']
return self.result
result['tags'] = resource['tags']
return result

def get_result(self, resource):
return self.update_result(resource, self.result)

def get_result_and_facts(self, facts_name, resource):
result = self.get_result(resource)
Expand Down
Expand Up @@ -9,7 +9,7 @@


ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'status': ['deprecated'],
'supported_by': 'community'}


Expand All @@ -19,6 +19,10 @@
short_description: Gathering facts from the API of instances from Apache CloudStack based clouds.
description:
- Gathering facts from the API of an instance.
deprecated:
removed_in: "2.13"
why: Transformed into an info module.
alternative: Use M(cs_instance_info) instead.
version_added: '2.1'
author: René Moser (@resmo)
options:
Expand Down
Expand Up @@ -5,7 +5,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'status': ['deprecated'],
'supported_by': 'community'}


Expand All @@ -16,6 +16,10 @@
description:
- Gathering facts from the API of a zone.
- Sets Ansible facts accessable by the key C(cloudstack_zone) and since version 2.6 also returns results.
deprecated:
removed_in: "2.13"
why: Transformed into an info module.
alternative: Use M(cs_zone_info) instead.
version_added: '2.1'
author: René Moser (@resmo)
options:
Expand Down