mirror of
https://github.com/munki/munki.git
synced 2026-01-05 22:20:00 -06:00
Bumped tools version to 0.4.9.
Changed munkistatus.py to follow Apple's recommendations and use a launchd LaunchAgent to launch MunkiStatus.app instead of using LaunchServices from a daemon. git-svn-id: http://munki.googlecode.com/svn/trunk@419 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -41,7 +41,7 @@ import FoundationPlist
|
||||
|
||||
def get_version():
|
||||
'''Returns version of munkitools'''
|
||||
return "0.4.8"
|
||||
return "0.4.9"
|
||||
|
||||
|
||||
# output and logging functions
|
||||
|
||||
@@ -32,15 +32,27 @@ import time
|
||||
s = None
|
||||
|
||||
def launchMunkiStatus():
|
||||
# first let LaunchServices try
|
||||
retcode = subprocess.call(["/usr/bin/open", "-a", "MunkiStatus.app"])
|
||||
if retcode:
|
||||
# that failed; let's look for an exact path
|
||||
munkiStatusPath = \
|
||||
"/Library/Application Support/Managed Installs/MunkiStatus.app"
|
||||
if os.path.exists(munkiStatusPath):
|
||||
retcode = subprocess.call(["/usr/bin/open", "-a",
|
||||
munkiStatusPath])
|
||||
# use launchd KeepAlive path so it launches from a launchd agent
|
||||
# in the correct context.
|
||||
# this is more complicated to set up, but makes Apple (and launchservices)
|
||||
# happier.
|
||||
# there needs to be a launch agent that is triggered when the launchfile
|
||||
# is created; and that launch agent then runs MunkiStatus.app.
|
||||
launchfile = "/var/run/com.googlecode.munki.munkistatus"
|
||||
cmd = ['/usr/bin/touch', launchfile]
|
||||
retcode = subprocess.call(cmd)
|
||||
if os.path.exists(launchfile):
|
||||
os.unlink(launchfile)
|
||||
|
||||
# OLD: let LaunchServices try
|
||||
#retcode = subprocess.call(["/usr/bin/open", "-a", "MunkiStatus.app"])
|
||||
#if retcode:
|
||||
# # that failed; let's look for an exact path
|
||||
# munkiStatusPath = \
|
||||
# "/Library/Application Support/Managed Installs/MunkiStatus.app"
|
||||
# if os.path.exists(munkiStatusPath):
|
||||
# retcode = subprocess.call(["/usr/bin/open", "-a",
|
||||
# munkiStatusPath])
|
||||
|
||||
|
||||
def launchAndConnectToMunkiStatus():
|
||||
@@ -112,17 +124,16 @@ def getMunkiStatusPID():
|
||||
|
||||
|
||||
def getMunkiStatusSocket():
|
||||
pid = getMunkiStatusPID()
|
||||
if pid:
|
||||
socketpath = "/tmp/com.googlecode.munki.munkistatus.%s" % pid
|
||||
for i in range(0,5):
|
||||
for i in range(0,10):
|
||||
pid = getMunkiStatusPID()
|
||||
if pid:
|
||||
socketpath = "/tmp/com.googlecode.munki.munkistatus.%s" % pid
|
||||
if os.path.exists(socketpath):
|
||||
return socketpath
|
||||
else:
|
||||
# sleep and try again
|
||||
time.sleep(.2)
|
||||
else:
|
||||
return ""
|
||||
return ""
|
||||
|
||||
|
||||
def activate():
|
||||
|
||||
Reference in New Issue
Block a user