summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Tools
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-03-19 18:50:37 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-03-19 18:50:37 +0000
commit5aa449d28e421ea1c6b84caaf78512e195a4472c (patch)
tree8e69ed3dd6acb27efc1241ea30ca545f7e6488a0 /src/lib/Client/Tools
parenta948f086182ed73eeb37dd939ba2b69604d203c2 (diff)
downloadbcfg2-5aa449d28e421ea1c6b84caaf78512e195a4472c.tar.gz
bcfg2-5aa449d28e421ea1c6b84caaf78512e195a4472c.tar.bz2
bcfg2-5aa449d28e421ea1c6b84caaf78512e195a4472c.zip
launchd update for 10.5 (patch from Kamil Kisiel)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5132 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Tools')
-rw-r--r--src/lib/Client/Tools/launchd.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/Client/Tools/launchd.py b/src/lib/Client/Tools/launchd.py
index 717a084a9..90bc14aa5 100644
--- a/src/lib/Client/Tools/launchd.py
+++ b/src/lib/Client/Tools/launchd.py
@@ -40,6 +40,17 @@ class launchd(Bcfg2.Client.Tools.Tool):
except KeyError:
return None
+ def os_version(self):
+ version = ""
+ try:
+ vers = self.cmd.run('sw_vers')[1]
+ except:
+ return version
+
+ for line in vers:
+ if line.startswith("ProductVersion"):
+ version = line.split()[-1]
+ return version
def VerifyService(self, entry, _):
'''Verify Launchd Service Entry'''
@@ -47,6 +58,10 @@ class launchd(Bcfg2.Client.Tools.Tool):
services = self.cmd.run("/bin/launchctl list")[1]
except IndexError:#happens when no services are running (should be never)
services = []
+ # launchctl output changed in 10.5
+ # It is now three columns, with the last column being the name of the # service
+ if self.os_version().startswith('10.5'):
+ services = [s.split()[-1] for s in services]
if entry.get('name') in services:#doesn't check if non-spawning services are Started
return entry.get('status') == 'on'
else: