Now uses SBApplication.applicationWithURL_ to get the _MunkiStatusApp object if SBApplication.applicationWithBundleIdentifier_ fails, which it might if MunkiStatus has never been launched on that particular machine.

git-svn-id: http://munki.googlecode.com/svn/trunk@496 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-03-04 22:48:02 +00:00
parent 7c6832dd2e
commit 92667c9a9b
+6 -1
View File
@@ -23,7 +23,7 @@ import subprocess
import FoundationPlist
import time
from Foundation import NSDate
from Foundation import NSDate, NSURL
from ScriptingBridge import SBApplication
_updatechecklaunchfile = "/private/tmp/.com.googlecode.munki.updatecheck.launchd"
@@ -109,6 +109,11 @@ def updateInProgress():
_MunkiStatusApp = SBApplication.applicationWithBundleIdentifier_(_MunkiStatusIdentifier)
if not _MunkiStatusApp:
# LaunchServices can't find MunkiStatus.app
# Maybe it's never been launched. Let's look by path
fileurl = NSURL.fileURLWithPath_("/Applications/Utilities/Managed Software Update.app/Contents/Resources/MunkiStatus.app")
_MunkiStatusApp = SBApplication.applicationWithURL_(fileurl)
if not _MunkiStatusApp:
# OK, now we're screwed. Can't find MunkiStatus.app at all.
return -1
# if MunkiStatus is running, we're doing an update right now
if _MunkiStatusApp.isRunning():