From 5e1781852fb81a3263692eda3b4977c8fb761c1a Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 15 Aug 2007 16:31:31 -0400 Subject: Ben Riggs patch to allow find to take arbitrary variables plus a reworking of find (mpd) to add some error checking, list returns, and other semi-useful stuff. Plus tests and an optomization to allow name=foo as the only parameter to be just as fast as before. --- cobbler/item_system.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cobbler/item_system.py') diff --git a/cobbler/item_system.py b/cobbler/item_system.py index cb7d02f..3575d79 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -93,9 +93,9 @@ class System(item.Item): Return object next highest up the tree. """ if self.parent is None or self.parent == '': - return self.config.profiles().find(self.profile) + return self.config.profiles().find(name=self.profile) else: - return self.config.systems().find(self.parent) + return self.config.systems().find(name=self.parent) def set_name(self,name): """ @@ -180,10 +180,10 @@ class System(item.Item): def set_profile(self,profile_name): """ - Set the system to use a certain named profile. The profile - must have already been loaded into the Profiles collection. - """ - p = self.config.profiles().find(profile_name) + Set the system to use a certain named profile. The profile + must have already been loaded into the Profiles collection. + """ + p = self.config.profiles().find(name=profile_name) if p is not None: self.profile = profile_name self.depth = p.depth + 1 # subprofiles have varying depths. @@ -229,8 +229,8 @@ class System(item.Item): def is_valid(self): """ - A system is valid when it contains a valid name and a profile. - """ + A system is valid when it contains a valid name and a profile. + """ # NOTE: this validation code does not support inheritable distros at this time. # this is by design as inheritable systems don't make sense. if self.name is None: -- cgit