HewlettPackard / oneview-ansible-collection

Ansible Collection and Sample Playbooks for HPE OneView
Apache License 2.0
25 stars 22 forks source link

oneview_logical_interconnect_group.py does not handle empty uplinksets #221

Closed frippe75 closed 1 year ago

frippe75 commented 1 year ago

Created an empty uplinkset named 'Test'

Then went on to try to add some new networks to that LIG and the new Uplinkset.

      oneview_logical_interconnect_group:
        config: "{{ config }}"
        state: present
        data:
          name: 'LIG1'
          enclosureType: 'SY12000'
          uplinkSets:
            - name: 'Test'
              mode: 'Auto'
              networkType: 'Ethernet'
              networkNames:
                - 'VLAN_1100'
                - 'VLAN_1101'

It error out on:

/ansible_collections/hpe/oneview/plugins/modules/oneview_logical_interconnect_group.py\", line 323, in __replace_uplinkset_port_values\nTypeError: 'NoneType' object is not iterable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"

Looking at the source code

for uplinkSet in self.data['uplinkSets']:
                    existingLogicalPortConfigInfos = uplinkSet.get('logicalPortConfigInfos')
                    for item in existingLogicalPortConfigInfos:

Looks like the uplinkSet.get('logicalPortConfigInfos') returns nothing. Maybe check for this and handle accordingly?

alisha-k-kalladassery commented 1 year ago

Hi Fredrick,

We will check on this and get back to you.

Thanks

alisha-k-kalladassery commented 1 year ago

Hi Fredrick,

We have added this issue to our work item and would be available part of OV8.0 release.

frippe75 commented 1 year ago

Hi, so in the meantime is there a workaround? Working for a HPE Global 100 account and need to automate a few things. So is it enough to do a get of the full object and parse out the uplinkset and merge in my own data?