From: Ondrej Lichtner <olichtne(a)redhat.com>
If a machine in the recipe contained a parameter that was not defined
on a pool machine that was being compared lnst would fail with a
KeyError exception. This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/SlavePool.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index cd9e508..170c9ac 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -371,7 +371,8 @@ class SetupMapper:
# check machine properties
for prop_name, prop_value in template_machine["params"].iteritems():
- if pool_machine["params"][prop_name] != prop_value:
+ if prop_name not in pool_machine["params"] or\
+ pool_machine["params"][prop_name] != prop_value:
return False
# check number of devices
@@ -660,7 +661,8 @@ class SetupMapper:
def _machine_matches(self, tm, pm):
for prop_name, prop_value in tm["params"].iteritems():
- if pm["params"][prop_name] != prop_value:
+ if prop_name not in pm["params"] or\
+ pm["params"][prop_name] != prop_value:
return False
return True
--
1.8.3.1