From ed3873ed40ccde84ec18e27a7aa43147269056fa Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 24 Oct 2007 15:38:47 -0400 Subject: Call deserialize after the pre-sync triggers are run to allow those triggers to insert or modify additional cobbler objects, such as via LDAP, despite not sharing the API handle since they are called out of process. --- cobbler/action_sync.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'cobbler/action_sync.py') diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index 9da375f..7efa0b5 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -60,9 +60,21 @@ class BootSync: Syncs the current configuration file with the config tree. Using the Check().run_ functions previously is recommended """ - utils.run_triggers(None, "/var/lib/cobbler/triggers/sync/pre/*") if not os.path.exists(self.settings.tftpboot): raise CX(_("cannot find directory: %s") % self.settings.tftpboot) + + # run pre-triggers... + utils.run_triggers(None, "/var/lib/cobbler/triggers/sync/pre/*") + + # in case the pre-trigger modified any objects... + self.api.deserialize() + self.distros = self.config.distros() + self.profiles = self.config.profiles() + self.systems = self.config.systems() + self.settings = self.config.settings() + self.repos = self.config.repos() + + # execute the core of the sync operation self.clean_trees() self.copy_bootloaders() self.copy_distros() @@ -74,6 +86,8 @@ class BootSync: self.regen_ethers() self.regen_hosts() self.make_pxe_menu() + + # run post-triggers utils.run_triggers(None, "/var/lib/cobbler/triggers/sync/post/*") return True -- cgit