s/GuiCacheAgeSecs/CheckResultsCacheSeconds/ per a discussion with gneagle.

Also, add to default_prefs, even though default is None/unset, a rrmiddleton pointed out this documents which prefs MSU might use.
This commit is contained in:
Justin McWilliams
2012-12-17 10:52:13 -05:00
parent dc37943b46
commit 15e082ae45
2 changed files with 12 additions and 10 deletions

View File

@@ -121,7 +121,8 @@ class MSUAppDelegate(NSObject):
# otherwise, only check for updates if the last check is over the
# configured manualcheck cache age max.
max_cache_age = (
munki.pref('GuiCacheAgeSecs') or DEFAULT_GUI_CACHE_AGE_SECS)
munki.pref('CheckResultsCacheSeconds') or
DEFAULT_GUI_CACHE_AGE_SECS)
if lastcheck.timeIntervalSinceNow() * -1 > int(max_cache_age):
self.checkForUpdates()
return
@@ -133,8 +134,8 @@ class MSUAppDelegate(NSObject):
if self._listofupdates:
self.displayUpdatesWindow()
else:
# only check for updates if GuiCacheAgeSecs is not defined.
if munki.pref('GuiCacheAgeSecs'):
# only check for updates if cache secs config is not defined.
if munki.pref('CheckResultsCacheSeconds'):
self.mainWindowController.theWindow.makeKeyAndOrderFront_(self)
self.noUpdatesAlert()
else:

View File

@@ -128,6 +128,7 @@ def pref(pref_name):
'AppleSoftwareUpdatesOnly': False,
'ShowRemovalDetail': False,
'InstallRequiresLogout': False
'CheckResultsCacheSeconds': None,
}
pref_value = CFPreferencesCopyAppValue(pref_name, BUNDLE_ID)
if pref_value == None:
@@ -211,25 +212,25 @@ def earliestForceInstallDate():
Returns None or earliest force_install_after_date converted to local time
"""
earliest_date = None
installinfo = getInstallInfo()
for install in installinfo.get('managed_installs', []):
this_force_install_date = install.get('force_install_after_date')
if this_force_install_date:
this_force_install_date = discardTimeZoneFromDate(
this_force_install_date)
if not earliest_date or this_force_install_date < earliest_date:
earliest_date = this_force_install_date
return earliest_date
def discardTimeZoneFromDate(the_date):
"""Input: NSDate object
Output: NSDate object with same date and time as the UTC.
In Los Angeles (PDT), '2011-06-20T12:00:00Z' becomes
In Los Angeles (PDT), '2011-06-20T12:00:00Z' becomes
'2011-06-20 12:00:00 -0700'.
In New York (EDT), it becomes '2011-06-20 12:00:00 -0400'.
"""
@@ -356,7 +357,7 @@ def logoutAndUpdate():
try:
if not os.path.exists(INSTALLATLOGOUTFILE):
open(INSTALLATLOGOUTFILE, 'w').close()
open(INSTALLATLOGOUTFILE, 'w').close()
logoutNow()
except (OSError, IOError):
return 1
@@ -384,7 +385,7 @@ def justUpdate():
return 0
except (OSError, IOError):
return 1
def getRunningProcesses():
"""Returns a list of paths of running processes"""