From: Ondrej Lichtner <olichtne(a)redhat.com>
When there were no options specified for an ovs internal port, the slave
configuration would fail, with an exception, trying to access a
nonexistant dictionary key. This could be fixe both on the controller
side by sending an empty list of options from the XML parser or on the
slave by checking if the key is defined. However, since we're soon going
to move to pure python recipes I decided to fix it just on the slave
since it's sufficient and the problem won't reappear after the Python
recipes switch.
Fixes #175.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NetConfigDevice.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index a0fa0e1..89d471e 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -518,11 +518,12 @@ class NetConfigDeviceOvsBridge(NetConfigDeviceGeneric):
i["name"] =
self._if_manager.assign_name_generic(prefix="int")
options = ""
- for opt in i["options"]:
- options += " %s=%s" % (opt["name"],
opt["value"])
+ if "options" in i:
+ for opt in i["options"]:
+ options += " %s=%s" % (opt["name"],
opt["value"])
- if opt["name"] == "name":
- i["name"] = opt["value"]
+ if opt["name"] == "name":
+ i["name"] = opt["value"]
exec_cmd("ovs-vsctl add-port %s %s -- set Interface %s "\
"type=internal %s" % (br_name, i["name"],
--
2.9.0