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_dvswitch bug when adding contact info #608

Closed
aleksandar-kinanov opened this issue Jan 14, 2021 · 4 comments · Fixed by #614
Closed

vmware_dvswitch bug when adding contact info #608

aleksandar-kinanov opened this issue Jan 14, 2021 · 4 comments · Fixed by #614
Assignees
Labels
bug This issue/PR relates to a bug cloud easyfix Good for new comers and easy to start with contribution has_pr plugins plugin (any type) python3 waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@aleksandar-kinanov
Copy link

aleksandar-kinanov commented Jan 14, 2021

SUMMARY

There's a bug in how the contact info is added to vim.DistributedVirtualSwitch.ConfigInfo in the vmware_dvswitch module

ISSUE TYPE
  • Bug Report
COMPONENT NAME

https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_dvswitch.py#L368

ANSIBLE VERSION
2.9.15
OS / ENVIRONMENT

SUSE 12.4

STEPS TO REPRODUCE
- name: Configure DVS
  vmware_dvswitch:
    hostname: 'some.vcenter'
    username: 'admin'
    password: 'pass'
    validate_certs: no
    datacenter: 'datacenter1'
    switch: 'switch1'
    contact: 
      name: admin
      description: some_description
    state: present
  delegate_to: localhost
  tags:
    - vcenter_network
EXPECTED RESULTS

Successfully created DVswitch with the required contact information

ACTUAL RESULTS

An exception is thrown by VmomiSupport.py

{
    "msg": "contact",
    "exception": "  File \"/tmp/ansible_vmware_dvswitch_payload_jv5hsa4g/ansible_vmware_dvswitch_payload.zip/ansible/modules/vmware_dvswitch.py\", line 332, in process_state\n  File \"/tmp/ansible_vmware_dvswitch_payload_jv5hsa4g/ansible_vmware_dvswitch_payload.zip/ansible/modules/vmware_dvswitch.py\", line 371, in create_dvswitch\n  File \"/var/lib/awx/venv/ansible_new/lib/python3.6/site-packages/pyVmomi/VmomiSupport.py\", line 665, in __setattr__\n    CheckField(self._GetPropertyInfo(name), val)\n  File \"/var/lib/awx/venv/ansible_new/lib/python3.6/site-packages/pyVmomi/VmomiSupport.py\", line 470, in GetPropertyInfo\n    raise AttributeError(name)\n",
    "invocation": {
        "module_args": {
            "hostname": "some.vcenter",
            "username": "admin",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "validate_certs": false,
            "datacenter": "datacenter1",
            "switch": "switch1",
            "version": "6.5.0",
            "uplink_quantity": 4,
            "discovery_operation": "both",
            "discovery_proto": "lldp",
            "mtu": 9000,
            "contact": {
                "name": "admin",
                "description": "some_description"
            },
            "state": "present",
            "datacenter_name": "false",
            "switch_name": "switch1",
            "switch_version": "6.5.0",
            "port": 443,
            "multicast_filtering_mode": "basic",
            "uplink_prefix": "Uplink ",
            "health_check": {
                "vlan_mtu": false,
                "teaming_failover": false,
                "vlan_mtu_interval": 0,
                "teaming_failover_interval": 0
            },
            "proxy_host": null,
            "proxy_port": null,
            "folder": null,
            "description": null
        }
    },
    "_ansible_no_log": false,
    "changed": false,
    "_ansible_delegated_vars": {}
}

Due to IP issues, I am not allowed to do a PR, but I can propose a fix:
Change this:
https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_dvswitch.py#L368
To this:

spec.configSpec.contact = self.create_contact_spec()
@ansibullbot ansibullbot added bug This issue/PR relates to a bug needs_triage Needs a first human triage before being processed. python3 labels Jan 15, 2021
@Akasurde Akasurde added easyfix Good for new comers and easy to start with contribution waiting_on_contributor Needs help. Feel free to engage to get things unblocked labels Jan 18, 2021
@ansibullbot
Copy link

ansibullbot commented Jan 18, 2021

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added cloud module module plugins plugin (any type) and removed needs_triage Needs a first human triage before being processed. labels Jan 18, 2021
Akasurde added a commit to Akasurde/community.vmware that referenced this issue Jan 18, 2021
@Akasurde
Copy link
Member

resolved_by_pr #614

@Akasurde Akasurde removed the waiting_on_contributor Needs help. Feel free to engage to get things unblocked label Jan 18, 2021
@Akasurde Akasurde self-assigned this Jan 18, 2021
@ansibullbot
Copy link

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added has_pr waiting_on_contributor Needs help. Feel free to engage to get things unblocked and removed module module labels Jan 18, 2021
Akasurde added a commit to Akasurde/community.vmware that referenced this issue Jan 20, 2021
* Add contact to vmware_dvswitch integration test
* Add missing " in integration test

Fixes: ansible-collections#608

Signed-off-by: Abhijeet Kasurde <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug cloud easyfix Good for new comers and easy to start with contribution has_pr plugins plugin (any type) python3 waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants