diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2007-01-02 22:41:02 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2007-01-02 22:41:02 +0000 |
commit | 7d2e7fe406025dcb2406ce5836cc18725a576af3 (patch) | |
tree | 4bb24a7735597c16158c91b5e87139eba9c9eaca /src | |
parent | ee99cfb4139b25e2235abd9c773ff180bc93a2ca (diff) | |
download | bcfg2-7d2e7fe406025dcb2406ce5836cc18725a576af3.tar.gz bcfg2-7d2e7fe406025dcb2406ce5836cc18725a576af3.tar.bz2 bcfg2-7d2e7fe406025dcb2406ce5836cc18725a576af3.zip |
working on initial launchd service support implementation
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2617 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Client/Tools/launchd.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/Client/Tools/launchd.py b/src/lib/Client/Tools/launchd.py index eb925dd5c..2957c8869 100644 --- a/src/lib/Client/Tools/launchd.py +++ b/src/lib/Client/Tools/launchd.py @@ -51,5 +51,18 @@ class LaunchD(Bcfg2.Client.Tools.Tool): def BundleUpdated(self, bundle): '''Reload LaunchD plist''' - pass + for entry in [entry for entry in bundle if self.handlesEntry(entry)]: + if not self.canInstall(entry): + self.logger.error("Insufficient information to restart service %s" % (entry.get('name'))) + else: + if entry.get('status') == 'on': + #may need to start/stop as well! + self.logger.info("Reloading LaunchD service %s" % (entry.get("name"))) + #stop? + self.cmd.run("/bin/launchctl unload %s" % (entry.get("plist")))#what if it disappeared? how do we stop services that are currently running but the plist disappeared?! + self.cmd.run("/bin/launchctl load %s" % (entry.get("plist"))) + #start? + else: + #may need to stop as well! + self.cmd.run("/bin/launchctl unload %s" % (entry.get("plist"))) |