commit d8889358713ed1234be0dae93f3b23f6a0ce7116
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Sep 11 15:10:22 2013 +0200
SlavePool: fix exception when param not present
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>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/SlavePool.py | 6 ++++--
1 files 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
Show replies by date