diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-08-27 11:53:13 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-08-27 11:53:13 -0400 |
commit | ab3d095e7e32e6ac224bbe8de80fe6137e8df267 (patch) | |
tree | 849097aea069ec9645aeb655189cddaec78cf3ec /cobbler | |
parent | 2ead5ca92d371325a67d6cef0cf38c00e88c99b1 (diff) | |
parent | e31b10a25977251a8ca349c01fb90435b2905435 (diff) | |
download | third_party-cobbler-ab3d095e7e32e6ac224bbe8de80fe6137e8df267.tar.gz third_party-cobbler-ab3d095e7e32e6ac224bbe8de80fe6137e8df267.tar.xz third_party-cobbler-ab3d095e7e32e6ac224bbe8de80fe6137e8df267.zip |
Merge branch 'master' of ssh://git.fedoraproject.org/git/hosted/cobbler
Conflicts:
CHANGELOG
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/collection.py | 4 | ||||
-rw-r--r-- | cobbler/item_distro.py | 14 | ||||
-rw-r--r-- | cobbler/item_profile.py | 3 | ||||
-rw-r--r-- | cobbler/item_repo.py | 1 | ||||
-rw-r--r-- | cobbler/item_system.py | 5 | ||||
-rw-r--r-- | cobbler/utils.py | 7 |
6 files changed, 21 insertions, 13 deletions
diff --git a/cobbler/collection.py b/cobbler/collection.py index c113481..98e841c 100644 --- a/cobbler/collection.py +++ b/cobbler/collection.py @@ -154,6 +154,10 @@ class Collection(serializable.Serializable): """ if ref is None or not ref.is_valid(): raise CX(_("insufficient or invalid arguments supplied")) + + if ref.COLLECTION_TYPE != self.collection_type(): + raise CX(_("API error: storing wrong data type in collection")) + if not with_copy: # don't need to run triggers, so add it already ... self.listing[ref.name.lower()] = ref diff --git a/cobbler/item_distro.py b/cobbler/item_distro.py index 4a97fcf..fdec9c8 100644 --- a/cobbler/item_distro.py +++ b/cobbler/item_distro.py @@ -25,6 +25,7 @@ from rhpl.translate import _, N_, textdomain, utf8 class Distro(item.Item): TYPE_NAME = _("distro") + COLLECTION_TYPE = "distro" def clear(self,is_subobject=False): """ @@ -49,13 +50,9 @@ class Distro(item.Item): def get_parent(self): """ Return object next highest up the tree. - NOTE: conceptually there is no need for subdistros, but it's implemented - anyway for testing purposes + NOTE: conceptually there is no need for subdistros """ - if self.parent is None or self.parent == '': - return None - else: - return self.config.distros().find(name=self.parent) + return None def from_datastruct(self,seed_data): """ @@ -73,10 +70,11 @@ class Distro(item.Item): self.depth = self.load_item(seed_data,'depth',0) # backwards compatibility -- convert string entries to dicts for storage - if type(self.kernel_options) != dict: + if self.kernel_options != "<<inherit>>" and type(self.kernel_options) != dict: self.set_kernel_options(self.kernel_options) - if type(self.ks_meta) != dict: + if self.ks_meta != "<<inherit>>" and type(self.ks_meta) != dict: self.set_ksmeta(self.ks_meta) + return self def set_kernel(self,kernel): diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py index 4062826..3df3113 100644 --- a/cobbler/item_profile.py +++ b/cobbler/item_profile.py @@ -21,7 +21,8 @@ from rhpl.translate import _, N_, textdomain, utf8 class Profile(item.Item): TYPE_NAME = _("profile") - + COLLECTION_TYPE = "profile" + def make_clone(self): ds = self.to_datastruct() cloned = Profile(self.config) diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py index 726fa13..447e057 100644 --- a/cobbler/item_repo.py +++ b/cobbler/item_repo.py @@ -20,6 +20,7 @@ from rhpl.translate import _, N_, textdomain, utf8 class Repo(item.Item): TYPE_NAME = _("repo") + COLLECTION_TYPE = "repo" def make_clone(self): ds = self.to_datastruct() diff --git a/cobbler/item_system.py b/cobbler/item_system.py index 3575d79..445cf73 100644 --- a/cobbler/item_system.py +++ b/cobbler/item_system.py @@ -21,6 +21,7 @@ from rhpl.translate import _, N_, textdomain, utf8 class System(item.Item): TYPE_NAME = _("system") + COLLECTION_TYPE = "system" def make_clone(self): ds = self.to_datastruct() @@ -70,9 +71,9 @@ class System(item.Item): # backwards compatibility -- convert string entries to dicts for storage # this allows for better usage from the API. - if type(self.kernel_options) != dict: + if self.kernel_options != "<<inherit>>" and type(self.kernel_options) != dict: self.set_kernel_options(self.kernel_options) - if type(self.ks_meta) != dict: + if self.ks_meta != "<<inherit>>" and type(self.ks_meta) != dict: self.set_ksmeta(self.ks_meta) # backwards compatibility -- if name is an IP or a MAC, set appropriate fields diff --git a/cobbler/utils.py b/cobbler/utils.py index 34b77e8..7845960 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -307,7 +307,10 @@ def __consolidate(node,results): for key in node_data: value = node_data[key] if value != "<<inherit>>": - node_data_copy[key] = value + if type(value) == type({}): + node_data_copy[key] = value.copy() + else: + node_data_copy[key] = value for field in node_data_copy: @@ -328,7 +331,7 @@ def __consolidate(node,results): # or scalar. if type(data_item) == dict: # interweave hash results - results[field].update(data_item) + results[field].update(data_item.copy()) elif type(data_item) == list or type(data_item) == tuple: # add to lists (cobbler doesn't have many lists) # FIXME: should probably uniqueify list after doing this |