diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-11-16 16:09:27 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-11-16 16:09:27 -0500 |
commit | 3a1e1828c5fb1716fa07856b0744e40923133297 (patch) | |
tree | 64159d56415d1c929226f8ffa250c8ce04f2e971 /cobbler/collection.py | |
parent | 7f07008198e5ec6c6d1c4e2d6809e2870b3809d0 (diff) | |
download | cobbler-3a1e1828c5fb1716fa07856b0744e40923133297.tar.gz cobbler-3a1e1828c5fb1716fa07856b0744e40923133297.tar.xz cobbler-3a1e1828c5fb1716fa07856b0744e40923133297.zip |
Applying Ben Riggs patch to add API flag to disable triggers when adding
objects.
Diffstat (limited to 'cobbler/collection.py')
-rw-r--r-- | cobbler/collection.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cobbler/collection.py b/cobbler/collection.py index 8e6be39e..3f5b1923 100644 --- a/cobbler/collection.py +++ b/cobbler/collection.py @@ -96,7 +96,7 @@ class Collection(serializable.Serializable): item = self.factory_produce(self.config,seed_data) self.add(item) - def add(self,ref,with_copy=False): + def add(self,ref,with_copy=False,with_triggers=True): """ Add an object to the collection, if it's valid. Returns True if the object was added to the collection. Returns False if the @@ -126,7 +126,8 @@ class Collection(serializable.Serializable): # perform filesystem operations if with_copy: # failure of a pre trigger will prevent the object from being added - self._run_triggers(ref,"/var/lib/cobbler/triggers/add/%s/pre/*" % self.collection_type()) + if with_triggers: + self._run_triggers(ref,"/var/lib/cobbler/triggers/add/%s/pre/*" % self.collection_type()) self.listing[ref.name.lower()] = ref # save just this item if possible, if not, save @@ -146,7 +147,8 @@ class Collection(serializable.Serializable): print _("Internal error. Object type not recognized: %s") % type(ref) # save the tree, so if neccessary, scripts can examine it. - self._run_triggers(ref,"/var/lib/cobbler/triggers/add/%s/post/*" % self.collection_type()) + if with_triggers: + self._run_triggers(ref,"/var/lib/cobbler/triggers/add/%s/post/*" % self.collection_type()) # update children cache in parent object parent = ref.get_parent() |