vmware / ansible-for-nsxt

Ansible delivers simple IT automation that ends repetitive tasks and frees up DevOps teams for more strategic work. This project is to enable this automation for NSX-T installation.
Other
171 stars 145 forks source link

nsxt_uplink_profiles module fails after initial run #490

Open jdannenberg opened 9 months ago

jdannenberg commented 9 months ago

Describe the bug

After initially configuring uplink_profiles the module fails with error: line 245, in check_for_update\nKeyError: 'uplinks'

full traceback:

The full traceback is:
Traceback (most recent call last):
File "/home/runner/.ansible/tmp/ansible-tmp-1709029311.7666762-10855-223110382414027/AnsiballZ_nsxt_uplink_profiles.py", line 107, in <module>
_ansiballz_main()
File "/home/runner/.ansible/tmp/ansible-tmp-1709029311.7666762-10855-223110382414027/AnsiballZ_nsxt_uplink_profiles.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/runner/.ansible/tmp/ansible-tmp-1709029311.7666762-10855-223110382414027/AnsiballZ_nsxt_uplink_profiles.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.vmware.ansible_for_nsxt.plugins.modules.nsxt_uplink_profiles', init_globals=dict(_module_fqn='ansible_collections.vmware.ansible_for_nsxt.plugins.modules.nsxt_uplink_profiles', _modlib_path=modlib_path),
File "/usr/lib64/python3.8/runpy.py", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload_puinlc6c/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_uplink_profiles.py", line 360, in <module>
File "/tmp/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload_puinlc6c/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_uplink_profiles.py", line 308, in main
File "/tmp/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload_puinlc6c/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_uplink_profiles.py", line 245, in check_for_update
KeyError: 'uplinks'
failed: [blabla -> localhost] (item={'mtu': 9000, 'lags': [{'mode': 'ACTIVE', 'name': 'name-lag', 'timeout_type': 'FAST', 'number_of_uplinks': 2, 'load_balance_algorithm': 'SRCDESTIPVLAN'}], 'teaming': {'policy': 'LOADBALANCE_SRC_MAC', 'active_list': [{'uplink_name': 'name-lag', 'uplink_type': 'LAG'}]}, 'transport_vlan': 0}) => {
"ansible_loop_var": "profile",
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/runner/.ansible/tmp/ansible-tmp-1709029311.7666762-10855-223110382414027/AnsiballZ_nsxt_uplink_profiles.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/runner/.ansible/tmp/ansible-tmp-1709029311.7666762-10855-223110382414027/AnsiballZ_nsxt_uplink_profiles.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/runner/.ansible/tmp/ansible-tmp-1709029311.7666762-10855-223110382414027/AnsiballZ_nsxt_uplink_profiles.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.vmware.ansible_for_nsxt.plugins.modules.nsxt_uplink_profiles', init_globals=dict(_module_fqn='ansible_collections.vmware.ansible_for_nsxt.plugins.modules.nsxt_uplink_profiles', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload_puinlc6c/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_uplink_profiles.py\", line 360, in <module>\n File \"/tmp/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload_puinlc6c/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_uplink_profiles.py\", line 308, in main\n File \"/tmp/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload_puinlc6c/ansible_vmware.ansible_for_nsxt.nsxt_uplink_profiles_payload.zip/ansible_collections/vmware/ansible_for_nsxt/plugins/modules/nsxt_uplink_profiles.py\", line 245, in check_for_update\nKeyError: 'uplinks'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"profile": {
"lags": [
{
"load_balance_algorithm": "SRCDESTIPVLAN",
"mode": "ACTIVE",
"name": "name-lag",
"number_of_uplinks": 2,
"timeout_type": "FAST"
}
],
"mtu": 9000,
"teaming": {
"active_list": [
{
"uplink_name": "name-lag",
"uplink_type": "LAG"
}
],
"policy": "LOADBALANCE_SRC_MAC"
},
"transport_vlan": 0
},
"rc": 1
}

Reproduction steps

  1. Run task which configures uplink profiles using module nsxt_uplink_profiles
  2. Run task again.

Expected behavior

nsxt_uplink_profiles can be run against configured system.

Additional context

The error says that the diff_obj has no 'uplinks' key. However, if I make an API request the results.lags.uplinks (as list) is definitely there.