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

VMware: Change return key results from VMware modules #62161

Merged
merged 1 commit into from
Sep 13, 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
6 changes: 6 additions & 0 deletions changelogs/fragments/62083-vmware-internal_results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
minor_changes:
- vmware_datastore_maintenancemode now returns datastore_status instead of Ansible internal key results (https://github.com/ansible/ansible/issues/62083).
- vmware_host_kernel_manager now returns host_kernel_status instead of Ansible internal key results (https://github.com/ansible/ansible/issues/62083).
- vmware_host_ntp now returns host_ntp_status instead of Ansible internal key results (https://github.com/ansible/ansible/issues/62083).
- vmware_host_service_manager now returns host_service_status instead of Ansible internal key results (https://github.com/ansible/ansible/issues/62083).
- vmware_tag now returns tag_status instead of Ansible internal key results (https://github.com/ansible/ansible/issues/62083).
6 changes: 5 additions & 1 deletion docs/docsite/rst/porting_guides/porting_guide_2.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ No notable changes
Noteworthy module changes
-------------------------

No notable changes
* :ref:`vmware_datastore_maintenancemode <vmware_datastore_maintenancemode_module>` now returns ``datastore_status`` instead of Ansible internal key ``results``.
* :ref:`vmware_host_kernel_manager <vmware_host_kernel_manager_module>` now returns ``host_kernel_status`` instead of Ansible internal key ``results``.
* :ref:`vmware_host_ntp <vmware_host_ntp_module>` now returns ``host_ntp_status`` instead of Ansible internal key ``results``.
* :ref:`vmware_host_service_manager <vmware_host_service_manager_module>` now returns ``host_service_status`` instead of Ansible internal key ``results``.
* :ref:`vmware_tag <vmware_tag_module>` now returns ``tag_status`` instead of Ansible internal key ``results``.


Plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@
'''

RETURN = '''
results:
datastore_status:
description: Action taken for datastore
returned: always
type: dict
sample:
sample: {
"ds_226_01": "Datastore 'ds_226_01' is already in maintenance mode."
}
'''

try:
Expand Down Expand Up @@ -189,7 +191,7 @@ def ensure(self):
changed = False
if any(change_datastore_list):
changed = True
self.module.exit_json(changed=changed, results=datastore_results)
self.module.exit_json(changed=changed, datastore_status=datastore_results)


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
'''

RETURN = r'''
results:
host_kernel_status:
description:
- dict with information on what was changed, by ESXi host in scope.
returned: success
Expand Down Expand Up @@ -183,7 +183,7 @@ def check_host_configuration_state(self):
self.results[host.name]['changed'] = changed
self.results[host.name]['msg'] = msg

self.module.exit_json(changed=any(change_list), results=self.results)
self.module.exit_json(changed=any(change_list), host_kernel_status=self.results)


def main():
Expand Down
4 changes: 2 additions & 2 deletions lib/ansible/modules/cloud/vmware/vmware_host_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
'''

RETURN = r'''
results:
host_ntp_status:
description: metadata about host system's NTP configuration
returned: always
type: dict
Expand Down Expand Up @@ -256,7 +256,7 @@ def check_host_state(self):

if any(change_list):
changed = True
self.module.exit_json(changed=changed, results=self.results)
self.module.exit_json(changed=changed, host_ntp_status=self.results)

def check_ntp_servers(self, host):
"""Check configured NTP servers"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def service_ctrl(self):

if any(host_service_state):
changed = True
self.module.exit_json(changed=changed, results=self.results)
self.module.exit_json(changed=changed, host_service_status=self.results)

def check_service_state(self, host, service_name):
host_service_system = host.configManager.serviceSystem
Expand Down
12 changes: 5 additions & 7 deletions lib/ansible/modules/cloud/vmware/vmware_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
'''

RETURN = r'''
results:
tag_status:
description: dictionary of tag metadata
returned: on success
type: dict
Expand Down Expand Up @@ -176,10 +176,9 @@ def state_create_tag(self):

if tag_id:
self.module.exit_json(changed=True,
results=dict(msg="Tag '%s' created." % tag_spec.name,
tag_id=tag_id))
tag_status=dict(msg="Tag '%s' created." % tag_spec.name, tag_id=tag_id))
self.module.exit_json(changed=False,
results=dict(msg="No tag created", tag_id=tag_id))
tag_status=dict(msg="No tag created", tag_id=tag_id))

def state_unchanged(self):
"""
Expand Down Expand Up @@ -210,7 +209,7 @@ def state_update_tag(self):
results['msg'] = 'Tag %s updated.' % self.tag_name
changed = True

self.module.exit_json(changed=changed, results=results)
self.module.exit_json(changed=changed, tag_status=results)

def state_delete_tag(self):
"""
Expand All @@ -223,8 +222,7 @@ def state_delete_tag(self):
except Error as error:
self.module.fail_json(msg="%s" % self.get_error_message(error))
self.module.exit_json(changed=True,
results=dict(msg="Tag '%s' deleted." % self.tag_name,
tag_id=tag_id))
tag_status=dict(msg="Tag '%s' deleted." % self.tag_name, tag_id=tag_id))

def check_tag_status(self):
"""
Expand Down