Remove datacenter_name option from vmware_host_datastore (#47824)

The datacenter name isn't required to create a NFS or VMFS datastore.
The option isn't available in the spec.
This commit is contained in:
Christian Kotte 2018-11-14 10:13:48 +01:00 committed by ansibot
parent 82937654de
commit b964c46235

View file

@ -37,7 +37,9 @@ options:
datacenter_name: datacenter_name:
description: description:
- Name of the datacenter to add the datastore. - Name of the datacenter to add the datastore.
required: true - The datacenter isn't used by the API to create a datastore.
- Will be removed in 2.11.
required: false
datastore_name: datastore_name:
description: description:
- Name of the datastore to add/remove. - Name of the datastore to add/remove.
@ -89,7 +91,6 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}' hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: '{{ item.name }}' datastore_name: '{{ item.name }}'
datastore_type: '{{ item.type }}' datastore_type: '{{ item.type }}'
vmfs_device_name: 'naa.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' vmfs_device_name: 'naa.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
@ -103,7 +104,6 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}' hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: '{{ item.name }}' datastore_name: '{{ item.name }}'
datastore_type: '{{ item.type }}' datastore_type: '{{ item.type }}'
nfs_server: '{{ item.server }}' nfs_server: '{{ item.server }}'
@ -121,7 +121,6 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}' hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: '{{ item.name }}' datastore_name: '{{ item.name }}'
datastore_type: '{{ item.type }}' datastore_type: '{{ item.type }}'
nfs_server: '{{ item.server }}' nfs_server: '{{ item.server }}'
@ -139,7 +138,6 @@ EXAMPLES = r'''
hostname: '{{ vcenter_hostname }}' hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ datacenter }}'
datastore_name: NasDS_vol01 datastore_name: NasDS_vol01
esxi_hostname: '{{ inventory_hostname }}' esxi_hostname: '{{ inventory_hostname }}'
state: absent state: absent
@ -163,6 +161,7 @@ class VMwareHostDatastore(PyVmomi):
def __init__(self, module): def __init__(self, module):
super(VMwareHostDatastore, self).__init__(module) super(VMwareHostDatastore, self).__init__(module)
# NOTE: The below parameter is deprecated starting from Ansible v2.11
self.datacenter_name = module.params['datacenter_name'] self.datacenter_name = module.params['datacenter_name']
self.datastore_name = module.params['datastore_name'] self.datastore_name = module.params['datastore_name']
self.datastore_type = module.params['datastore_type'] self.datastore_type = module.params['datastore_type']
@ -284,7 +283,7 @@ class VMwareHostDatastore(PyVmomi):
def main(): def main():
argument_spec = vmware_argument_spec() argument_spec = vmware_argument_spec()
argument_spec.update( argument_spec.update(
datacenter_name=dict(type='str', required=True), datacenter_name=dict(type='str', required=False, removed_in_version=2.11),
datastore_name=dict(type='str', required=True), datastore_name=dict(type='str', required=True),
datastore_type=dict(type='str', choices=['nfs', 'nfs41', 'vmfs']), datastore_type=dict(type='str', choices=['nfs', 'nfs41', 'vmfs']),
nfs_server=dict(type='str'), nfs_server=dict(type='str'),