Non-string value for interface name leads os-net-config to exit ungracefully with TypeError: unhashable type: 'dict'

Bug #1781983 reported by Andreas Karis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-net-config
In Progress
Undecided
Bob Fournier

Bug Description

Non-string value for interface name leads os-net-config to exit ungracefully with TypeError: unhashable type: 'dict'
~~~
[root@overcloud-compute-0 ~]# os-net-config -v -c /etc/os-net-config/config.json
[2018/07/16 03:33:39 PM] [INFO] Using config file at: /etc/os-net-config/config.json
[2018/07/16 03:33:39 PM] [INFO] Ifcfg net config provider created.
[2018/07/16 03:33:39 PM] [INFO] Not using any mapping file.
[2018/07/16 03:33:40 PM] [INFO] Finding active nics
[2018/07/16 03:33:40 PM] [INFO] vxlan_sys_4789 is not an active nic
[2018/07/16 03:33:40 PM] [INFO] eth4 is an embedded active nic
[2018/07/16 03:33:40 PM] [INFO] eth3 is an embedded active nic
[2018/07/16 03:33:40 PM] [INFO] eth2 is an embedded active nic
[2018/07/16 03:33:40 PM] [INFO] eth1 is an embedded active nic
[2018/07/16 03:33:40 PM] [INFO] eth0 is an embedded active nic
[2018/07/16 03:33:40 PM] [INFO] lo is not an active nic
[2018/07/16 03:33:40 PM] [INFO] br-ex is not an active nic
[2018/07/16 03:33:40 PM] [INFO] docker0 is not an active nic
[2018/07/16 03:33:40 PM] [INFO] ovs-system is not an active nic
[2018/07/16 03:33:40 PM] [INFO] br-int is not an active nic
[2018/07/16 03:33:40 PM] [INFO] br-tun is not an active nic
[2018/07/16 03:33:40 PM] [INFO] No DPDK mapping available in path (/var/lib/os-net-config/dpdk_mapping.yaml)
[2018/07/16 03:33:40 PM] [INFO] Active nics are ['eth0', 'eth1', 'eth2', 'eth3', 'eth4']
[2018/07/16 03:33:40 PM] [INFO] nic5 mapped to: eth4
[2018/07/16 03:33:40 PM] [INFO] nic4 mapped to: eth3
[2018/07/16 03:33:40 PM] [INFO] nic3 mapped to: eth2
[2018/07/16 03:33:40 PM] [INFO] nic2 mapped to: eth1
[2018/07/16 03:33:40 PM] [INFO] nic1 mapped to: eth0
Traceback (most recent call last):
  File "/bin/os-net-config", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/os_net_config/cli.py", line 254, in main
    obj = objects.object_from_json(iface_json)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 47, in object_from_json
    return OvsBridge.from_json(json)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 543, in from_json
    fail_mode=fail_mode)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 500, in __init__
    nm_controlled, onboot)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 265, in __init__
    if name in mapped_nic_names:
TypeError: unhashable type: 'dict'
~~~

This happens when the input value is:
~~~
[root@overcloud-compute-0 ~]# cat /etc/os-net-config/config.json
{"network_config": [{"addresses": [{"ip_netmask": "192.168.24.11/24"}], "dns_servers": ["192.168.24.1"], "name": "nic1", "routes": [{"ip_netmask": "169.254.169.254/32", "next_hop": "192.168.24.1"}, {"default": true, "next_hop": "192.168.24.1"}], "type": "interface", "use_dhcp": false}, {"members": [{"name": "nic2", "primary": true, "type": "interface"}, {"addresses": [{"ip_netmask": "172.16.2.9/24"}], "type": "vlan", "vlan_id": 901}, {"addresses": [{"ip_netmask": "172.18.0.17/24"}], "type": "vlan", "vlan_id": 903}, {"addresses": [{"ip_netmask": "172.16.0.8/24"}], "type": "vlan", "vlan_id": 902}], "name": {get_input: bridge_name}, "type": "ovs_bridge", "use_dhcp": false}, {"defroute": false, "name": "nic3", "type": "interface", "use_dhcp": false}, {"defroute": false, "name": "nic4", "type": "interface", "use_dhcp": false}]}
~~~

Which in turn may happen if an administrator upgrades from an older version of tripleo to a newer version and forgets to change the bridge name in the templates from '{get_input: bridge_name}' to 'bridge_name'.
~~~
              -
                type: ovs_bridge
                name: {get_input: bridge_name}
                use_dhcp: false
                members:
~~~
vs
~~~
              -
                type: ovs_bridge
                name: bridge_name
                use_dhcp: false
                members:
~~~

Andreas Karis (akaris)
Changed in os-net-config:
assignee: nobody → Andreas Karis (akaris)
Changed in os-net-config:
status: New → In Progress
Changed in os-net-config:
assignee: Andreas Karis (akaris) → Bob Fournier (bfournie)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on os-net-config (master)

Change abandoned by Brent Eagles (<email address hidden>) on branch: master
Review: https://review.opendev.org/582989
Reason: The last code update on this was 2018-09-21 so I'm guessing this isn't a priority.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.