summaryrefslogtreecommitdiffstats
path: root/cobbler/collection.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-10-08 17:48:50 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-10-08 17:48:50 -0400
commitc86302a23426c3f087dc4b6a1741267e2228cc29 (patch)
tree963103106dd36bed5e5b55b94586c50848e9a67d /cobbler/collection.py
parent0b56b91457c3c6002c12c7cff15a08ce3e695e6a (diff)
downloadthird_party-cobbler-c86302a23426c3f087dc4b6a1741267e2228cc29.tar.gz
third_party-cobbler-c86302a23426c3f087dc4b6a1741267e2228cc29.tar.xz
third_party-cobbler-c86302a23426c3f087dc4b6a1741267e2228cc29.zip
Once again, all tests pass, however a lot more manual testing in regards to multiple NIC support
is still required. Checking kickstarts and the koan modifications are also still to go. Code in item_system.py is due for cleanup, especially in from_datastruct, where it tries to load the older configurations implicitly.
Diffstat (limited to 'cobbler/collection.py')
-rw-r--r--cobbler/collection.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/cobbler/collection.py b/cobbler/collection.py
index aa73412..75ce48c 100644
--- a/cobbler/collection.py
+++ b/cobbler/collection.py
@@ -86,7 +86,7 @@ class Collection(serializable.Serializable):
failed = False
obj = self.listing[name]
objdata = self.listing[name].to_datastruct()
-
+
# make sure that the object being queried actually has
# the property being queried -- only need to be run once
# this will ensure the user gets no unexpected false
@@ -96,7 +96,20 @@ class Collection(serializable.Serializable):
fields = objdata.keys()
for x in kargs.keys():
if not x in fields:
- raise CX(_("queried object has no field: %s") % x)
+ ok = False
+ # 2nd chance ...
+ # also check all of the intefaces, if there are any present...
+ if objdata.has_key("interfaces"):
+ if len(objdata["interfaces"]) == 0:
+ raise CX(_("internal error: interfaces of zero length"))
+ for interface in objdata["interfaces"]:
+ if interface.has_key(x):
+ ok = True
+ continue
+ # FIXME: something is possibly wrong with this check.
+ # disabling for now...
+ if not ok:
+ raise CX(_("queried object has no field: %s, %s") % (x,objdata))
argument_check_made = True
# now do the comparision...
@@ -112,6 +125,19 @@ class Collection(serializable.Serializable):
failed = True
continue
+ # now we must also process rejections in the interfaces subobject,
+ # if one exists, as that may have other reasons to reject the key.
+
+ if objdata.has_key("interfaces"):
+ match_ok = False
+ for interface in objdata["interfaces"]:
+ for key in interface.keys():
+ if kargs.has_key(key):
+ if str(kargs[key]).lower() != interface[key].lower():
+ failed = True
+ continue
+
+
# if no matches failed, this is our item
if not failed:
matches.append(obj)