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: correct documentation for datacenter #38718

Merged
merged 1 commit into from
Apr 13, 2018
Merged
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
34 changes: 17 additions & 17 deletions lib/ansible/modules/cloud/vmware/vmware_guest_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@
- PyVmomi
options:
name:
description:
- Name of the VM to work with.
- This is required if uuid is not supplied.
description:
- Name of the VM to work with.
- This is required if C(uuid) parameter is not supplied.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want mutually_exclusive=(['name', 'uuid'],),?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

uuid:
description:
- UUID of the instance to manage if known, this is VMware's BIOS UUID.
- This is required if name is not supplied.
description:
- UUID of the instance to manage if known, this is VMware's BIOS UUID.
- This is required if C(name) parameter is not supplied.
datacenter:
description:
- Destination datacenter for the find operation.
- Deprecated in 2.5, will be removed in 2.9 release.
required: True
description:
- Destination datacenter for the find operation.
- Deprecated in 2.5, will be removed in 2.9 release.
extends_documentation_fragment: vmware.documentation
'''

EXAMPLES = '''
EXAMPLES = r'''
- name: Find Guest's Folder using name
vmware_guest_find:
hostname: 192.168.1.209
Expand All @@ -68,16 +67,17 @@
description: List of folders for user specified virtual machine
returned: on success
type: list
sample: [
'/DC0/vm',
]
"""


from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
from ansible.module_utils.vmware import PyVmomi, get_all_objs, vmware_argument_spec


try:
import pyVmomi
from pyVmomi import vim
except ImportError:
pass
Expand All @@ -86,8 +86,6 @@
class PyVmomiHelper(PyVmomi):
def __init__(self, module):
super(PyVmomiHelper, self).__init__(module)
self.datacenter = None
self.folders = None
self.name = self.params['name']
self.uuid = self.params['uuid']

Expand All @@ -112,11 +110,13 @@ def main():
argument_spec.update(
name=dict(type='str'),
uuid=dict(type='str'),
datacenter=dict(removed_in_version=2.9, type='str', required=True)
datacenter=dict(removed_in_version=2.9, type='str')
)

module = AnsibleModule(argument_spec=argument_spec,
required_one_of=[['name', 'uuid']])
required_one_of=[['name', 'uuid']],
mutually_exclusive=[['name', 'uuid']],
)

pyv = PyVmomiHelper(module)
# Check if the VM exists before continuing
Expand Down