Open
Description
SUMMARY
While working on the CI to make it compatible with ansible-core 2.19 (#2388) I've seen the following:
2025-04-26 11:21:23.156655 | controller | TASK [prepare_vmware_tests : Remove any potential existing "VM Network" on vSwitch0] ***
2025-04-26 11:21:23.156665 | controller | task path: /home/zuul/.ansible/collections/ansible_collections/community/vmware/tests/integration/targets/prepare_vmware_tests/tasks/setup_attach_hosts.yml:34
2025-04-26 11:21:23.156685 | controller | Using module file /home/zuul/.ansible/collections/ansible_collections/community/vmware/plugins/modules/vmware_portgroup.py
2025-04-26 11:21:23.840710 | controller | Pipelining is enabled.
2025-04-26 11:21:23.840736 | controller | <testhost> ESTABLISH LOCAL CONNECTION FOR USER: zuul
2025-04-26 11:21:23.840742 | controller | <testhost> EXEC /bin/sh -c '/home/zuul/venv/bin/python && sleep 0'
2025-04-26 11:21:23.840747 | controller | failed: [testhost] (item=esxi1.test) => {
2025-04-26 11:21:23.840751 | controller | "ansible_loop_var": "item",
2025-04-26 11:21:23.840755 | controller | "changed": false,
2025-04-26 11:21:23.840759 | controller | "invocation": {
2025-04-26 11:21:23.840768 | controller | "module_args": {
2025-04-26 11:21:23.840772 | controller | "cluster_name": null,
2025-04-26 11:21:23.840776 | controller | "esxi_hostname": "esxi1.test",
2025-04-26 11:21:23.840781 | controller | "hostname": "vcenter.test",
2025-04-26 11:21:23.840785 | controller | "hosts": [
2025-04-26 11:21:23.840789 | controller | "esxi1.test"
2025-04-26 11:21:23.840793 | controller | ],
2025-04-26 11:21:23.840797 | controller | "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
2025-04-26 11:21:23.840801 | controller | "port": 443,
2025-04-26 11:21:23.840805 | controller | "portgroup": "VM Network",
2025-04-26 11:21:23.840810 | controller | "proxy_host": null,
2025-04-26 11:21:23.840814 | controller | "proxy_port": null,
2025-04-26 11:21:23.840818 | controller | "security": null,
2025-04-26 11:21:23.840822 | controller | "state": "absent",
2025-04-26 11:21:23.840826 | controller | "switch": "vSwitch0",
2025-04-26 11:21:23.840830 | controller | "teaming": null,
2025-04-26 11:21:23.840837 | controller | "traffic_shaping": null,
2025-04-26 11:21:23.840841 | controller | "username": "[email protected]",
2025-04-26 11:21:23.840845 | controller | "validate_certs": false,
2025-04-26 11:21:23.840849 | controller | "vlan_id": 0
2025-04-26 11:21:23.840853 | controller | }
2025-04-26 11:21:23.840857 | controller | },
2025-04-26 11:21:23.840862 | controller | "item": "esxi1.test",
2025-04-26 11:21:23.840866 | controller | "msg": "The portgroup already exists on vSwitch 'isolated_vSwitch'"
2025-04-26 11:21:23.840870 | controller | }
2025-04-26 11:21:23.840875 | controller | ...ignoring
It looks like it's impossible to remove a portgroup because the module seems to fail if it exists. This doesn't make sense to me.
ISSUE TYPE
- Bug Report
COMPONENT NAME
vmware_portgroup
ADDITIONAL INFORMATION
I think find_portgroup_by_name should just find the portgroup, but not fail if it exist:
community.vmware/plugins/modules/vmware_portgroup.py
Lines 388 to 390 in ce75a5a
Metadata
Metadata
Assignees
Labels
No labels