Repository: ansible-collections/community.vmware

Issue:
vmware_dvswitch idempotency broken with vSphere 7.0.1
##### SUMMARY

The second call fails with: `"msg": "Failed to update DVS version : ('A specified parameter was not correct: ProductSpec.version', None)"`

https://67c852f73dcdf0c2dfb3-0ccf87873bf01f37e305b0f143521d81.ssl.cf2.rackcdn.com/568/dc635f81a8c04a631c8f98c9f9a6554822279fea/check/ansible-test-cloud-integration-vcenter7_only-python36/5651c62/job-output.html#l26599

```
TASK [vmware_dvswitch : add distributed vSwitch again] *************************
task path: /home/zuul/.ansible/collections/ansible_collections/community/vmware/tests/integration/targets/vmware_dvswitch/tasks/main.yml:67
<testhost> ESTABLISH LOCAL CONNECTION FOR USER: zuul
<testhost> EXEC /bin/sh -c 'echo ~zuul && sleep 0'
<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zuul/.ansible/tmp `"&& mkdir "` echo /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798 `" && echo ansible-tmp-1608048501.0916786-36001-78830974297798="` echo /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798 `" ) && sleep 0'
Using module file /home/zuul/.ansible/collections/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch.py
<testhost> PUT /home/zuul/.ansible/tmp/ansible-local-35652_aplezpg/tmpyxkceyip TO /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798/AnsiballZ_vmware_dvswitch.py
<testhost> EXEC /bin/sh -c 'chmod u+x /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798/ /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798/AnsiballZ_vmware_dvswitch.py && sleep 0'
<testhost> EXEC /bin/sh -c '/tmp/python-aewn9r7k-ansible/python /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798/AnsiballZ_vmware_dvswitch.py && sleep 0'
<testhost> EXEC /bin/sh -c 'rm -f -r /home/zuul/.ansible/tmp/ansible-tmp-1608048501.0916786-36001-78830974297798/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_vmware_dvswitch_payload__g7z_igx/ansible_vmware_dvswitch_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch.py", line 685, in update_dvswitch
  File "/tmp/ansible_vmware_dvswitch_payload__g7z_igx/ansible_vmware_dvswitch_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py", line 83, in wait_for_task
    raise_from(TaskError(error_msg, host_thumbprint), task.info.error)
  File "<string>", line 3, in raise_from
fatal: [testhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "contact": null,
            "datacenter_name": "DC0",
            "description": null,
            "discovery_operation": "both",
            "discovery_proto": "lldp",
            "folder": null,
            "health_check": {
                "teaming_failover": false,
                "teaming_failover_interval": 0,
                "vlan_mtu": false,
                "vlan_mtu_interval": 0
            },
            "hostname": "vcenter.test",
            "mtu": 9000,
            "multicast_filtering_mode": "basic",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "proxy_host": null,
            "proxy_port": null,
            "state": "present",
            "switch_name": "dvswitch_0001",
            "switch_version": null,
            "uplink_prefix": "Uplink ",
            "uplink_quantity": 2,
            "username": "administrator@vsphere.local",
            "validate_certs": false
        }
    },
    "msg": "Failed to update DVS version : ('A specified parameter was not correct: ProductSpec.version', None)"
```

<!--- Explain the problem briefly below -->

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME

vmware_dvswitch


Discussion:

Resolving patch:
diff --git a/plugins/modules/vmware_dvswitch.py b/plugins/modules/vmware_dvswitch.py
--- a/plugins/modules/vmware_dvswitch.py
+++ b/plugins/modules/vmware_dvswitch.py
@@ -277,10 +277,6 @@ def __init__(self, module):
 
         self.switch_name = self.module.params['switch_name']
         self.switch_version = self.module.params['switch_version']
-        if self.content.about.version == '6.7.0':
-            self.vcenter_switch_version = '6.6.0'
-        else:
-            self.vcenter_switch_version = self.content.about.version
         folder = self.params['folder']
         if folder:
             self.folder_obj = self.content.searchIndex.FindByInventoryPath(folder)
@@ -653,10 +649,8 @@ def update_dvswitch(self):
                 changed_version = True
                 spec_product = self.create_product_spec(self.switch_version)
         else:
-            results['version'] = self.vcenter_switch_version
-            if self.dvs.config.productInfo.version != self.vcenter_switch_version:
-                changed_version = True
-                spec_product = self.create_product_spec(self.vcenter_switch_version)
+            results['version'] = self.dvs.config.productInfo.version
+            changed_version = False
         if changed_version:
             changed = True
             changed_list.append("switch version")


Test patch: