Skip to content

Commit

Permalink
Fix sonic-mgmt testbed-cli interface_to_vms undefined failure. (#12890)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
This change is to fix the error above, when VM list is empty.

How did you do it?
The fix is straightforward - to give it a default value that is an empty list when enumerating.

How did you verify/test it?
The change is run locally with topology with empty VMs, and it works.
  • Loading branch information
r12f authored and mssonicbld committed Dec 13, 2024
1 parent e8be8be commit 0fa7639
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
set_fact:
intf_names: "{{ intf_names | default({}) | combine({item.0.name: intf_names[item.0.name]|default([]) + [ port_alias[item.1]] }) }}"
with_subelements:
- "{{ interface_to_vms }}"
- "{{ interface_to_vms | default([]) }}"
- "ports"
when: "'cable' not in topo"

Expand All @@ -272,7 +272,7 @@
vm_asic_ifnames: "{{ vm_asic_ifnames | default({}) | combine({item.0.name: vm_asic_ifnames[item.0.name]|default([]) + [ front_panel_asic_ifnames[item.1]] }) }}"
vm_asic_ids: "{{ vm_asic_ids | default({}) | combine({item.0.name: vm_asic_ids[item.0.name]|default([]) + [ front_panel_asic_ifs_asic_id[item.1]] }) }}"
with_subelements:
- "{{ interface_to_vms }}"
- "{{ interface_to_vms | default([]) }}"
- "ports"
when: front_panel_asic_ifnames != []

Expand Down

0 comments on commit 0fa7639

Please sign in to comment.