summaryrefslogtreecommitdiffstats
path: root/cobbler/collection.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-12-18 12:32:19 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-12-18 12:32:19 -0500
commit510ec333d4e26d30b998abd320c0c02f56d83af8 (patch)
tree7527520ff8c39ba487fe7c88535d92d7a0953674 /cobbler/collection.py
parent13ea0a8fcc2b8a12b410372d7861fa2f5d825801 (diff)
downloadcobbler-510ec333d4e26d30b998abd320c0c02f56d83af8.tar.gz
cobbler-510ec333d4e26d30b998abd320c0c02f56d83af8.tar.xz
cobbler-510ec333d4e26d30b998abd320c0c02f56d83af8.zip
The repo management code generates some things on a per-profile basis which
should be generated on a per-system basis to support --server-override correctly. This is a fix.
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 2fe39677..a06a6637 100644
--- a/cobbler/collection.py
+++ b/cobbler/collection.py
@@ -27,6 +27,31 @@ import item_repo
from rhpl.translate import _, N_, textdomain, utf8
+class ProxiedItem:
+
+ def __init__(self,collection,seed_data):
+
+ self.real_object = None
+ self.collection = collection
+ self.config = collection.config
+ self.seed_data = seed_data
+
+
+ def __getattr__(self,name):
+
+ if self.real_object is not None:
+ return getattr(self.real_object,name)
+
+ if name == "name":
+ return self.seed_data["name"]
+
+ self.real_object = self.collection.factory_produce(
+ self.config,
+ self.seed_data
+ )
+
+ return getattr(self.real_object, name)
+
class Collection(serializable.Serializable):
def __init__(self,config):
@@ -95,8 +120,9 @@ class Collection(serializable.Serializable):
if datastruct is None:
return
for seed_data in datastruct:
- item = self.factory_produce(self.config,seed_data)
- self.add(item)
+ #item = self.factory_produce(self.config,seed_data)
+ #self.add(item)
+ self.add(ProxiedItem(self,seed_data))
def add(self,ref,save=False,with_copy=False,with_triggers=True,with_sync=True,quick_pxe_update=False):
"""