mirror of
https://github.com/munki/munki.git
synced 2026-01-26 17:09:30 -06:00
Merge branch 'master' of https://code.google.com/p/munki
This commit is contained in:
@@ -118,6 +118,29 @@ class MSUAppDelegate(NSObject):
|
||||
# no updates available. Should we check for some?
|
||||
self.checkForUpdates()
|
||||
|
||||
|
||||
def _sortUpdateList(self, l):
|
||||
# pop any forced install items off the list.
|
||||
forced_items = []
|
||||
i = 0
|
||||
while i < len(l):
|
||||
if l[i].get('force_install_after_date'):
|
||||
forced_items.append(l.pop(i))
|
||||
else:
|
||||
i += 1
|
||||
# sort the regular update list, preferring display_name to name.
|
||||
sort_lambda = lambda i: (i.get('display_name') or i.get('name')).lower()
|
||||
l.sort(key=sort_lambda)
|
||||
# if there were any forced items, add them to the top of the list.
|
||||
if forced_items:
|
||||
# sort forced items by datetime, reversed so soonest is last.
|
||||
forced_items.sort(
|
||||
key=lambda i: i.get('force_install_after_date'), reverse=True)
|
||||
# insert items at top of the list one by one, so soonest is first.
|
||||
for i in forced_items:
|
||||
l.insert(0, i)
|
||||
|
||||
|
||||
def updateAvailableUpdates(self):
|
||||
NSLog(u"Managed Software Update got update notification")
|
||||
if self.mainWindowController.theWindow.isVisible():
|
||||
@@ -290,6 +313,7 @@ class MSUAppDelegate(NSObject):
|
||||
if installinfo:
|
||||
optionalInstalls = installinfo.get("optional_installs", [])
|
||||
if optionalInstalls:
|
||||
self._sortUpdateList(optionalInstalls)
|
||||
self._optionalInstalls = optionalInstalls
|
||||
self.update_view_controller.optionalSoftwareBtn.setHidden_(NO)
|
||||
else:
|
||||
@@ -338,6 +362,7 @@ class MSUAppDelegate(NSObject):
|
||||
updatelist.append(row)
|
||||
|
||||
if updatelist:
|
||||
self._sortUpdateList(updatelist)
|
||||
self._listofupdates = updatelist
|
||||
self.enableUpdateNowBtn_(YES)
|
||||
#self.performSelector_withObject_afterDelay_("enableUpdateNowBtn:", YES, 4)
|
||||
|
||||
@@ -880,6 +880,7 @@ class AppleUpdates(object):
|
||||
results['installed'] = []
|
||||
results['download'] = []
|
||||
|
||||
last_output = None
|
||||
while True:
|
||||
if stop_allowed and munkicommon.stopRequested():
|
||||
job.stop()
|
||||
@@ -895,6 +896,12 @@ class AppleUpdates(object):
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
# Don't bother parsing the stdout output if it hasn't changed since
|
||||
# the last loop iteration.
|
||||
if last_output == output:
|
||||
continue
|
||||
last_output = output
|
||||
|
||||
output = output.decode('UTF-8').strip()
|
||||
# send the output to STDOUT or MunkiStatus as applicable
|
||||
if output.startswith('Progress: '):
|
||||
|
||||
Reference in New Issue
Block a user