Post 10.5.X fix: munkicommon.pythonScriptRunning() now correctly determines if another instance of the given script is running. (This broke in a post-Leopard release)

getManagedInstallPrefs() now writes out a 'default' preferences file to /Library/Preferences/ManagedInstalls.plist if the file doesn't exist.

getManagedInstallPrefs() now writes an error message to the log and raises an exception if it can't read the prefs file.

git-svn-id: http://munki.googlecode.com/svn/trunk@190 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2009-08-27 16:35:50 +00:00
parent bc34da0157
commit b56d53bc94
+8 -5
View File
@@ -213,7 +213,7 @@ def pythonScriptRunning(scriptname):
for line in lines:
(pid, proc) = line.split(None,1)
# first look for Python processes
if proc.find("MacOS/Python ") != -1:
if proc.find("MacOS/Python ") != -1 or proc.find("python ") != -1:
if proc.find(scriptname) != -1:
if int(pid) != int(mypid):
return pid
@@ -280,8 +280,8 @@ def getManagedInstallsPrefs():
prefs['ClientIdentifier'] = ""
prefs['LogFile'] = os.path.join(prefs['ManagedInstallDir'], "Logs", "ManagedSoftwareUpdate.log")
prefs['LoggingLevel'] = 1
prefs['InstallAppleSoftwareUpdates'] = False
prefs['SoftwareUpdateServerURL'] = None
#prefs['InstallAppleSoftwareUpdates'] = False
#prefs['SoftwareUpdateServerURL'] = None
prefs['DaysBetweenNotifications'] = 1
prefs['LastNotifiedDate'] = '1970-01-01 00:00:00 -0000'
# Added by bcw
@@ -299,10 +299,13 @@ def getManagedInstallsPrefs():
else:
prefs[key] = pl[key]
except:
display_error("ERROR: Problem reading %s. Using defaults." % prefsfile)
display_error("ERROR: Could not read preferences file %s." % prefsfile)
raise Exception("Could not read preferences file %s." % prefsfile)
else:
#display_error("WARNING: No prefs file found at %s. Using defaults." % prefsfile)
pass
# no prefs file, so we'll write out a "default" prefs file
del prefs['LastNotifiedDate']
FoundationPlist.writePlist(prefs, prefsfile)
return prefs