Example #1
0
    def getAvailableUpdates(self):
        updatelist = []
        installinfo = munki.getInstallInfo()
        if installinfo:
            updatelist = installinfo.get("managed_installs", [])
            for update in updatelist:
                force_install_after_date = update.get('force_install_after_date')
                if force_install_after_date:
                    # insert installation deadline into description
                    local_date = munki.discardTimeZoneFromDate(force_install_after_date)
                    date_str = munki.stringFromDate(local_date)
                    forced_date_text = NSLocalizedString(u"This item must be installed by ", None)
                    description = update["description"]
                    # prepend deadline info to description. This will fail if the description is HTML...
                    update["description"] = forced_date_text + date_str + "\n\n" + description

            if installinfo.get("removals"):
                removallist = installinfo.get("removals")
                restartNeeded = False
                showRemovalDetail = munki.getRemovalDetailPrefs()
                for item in removallist:
                    if item.get("RestartAction") == "RequireRestart" or item.get("RestartAction") == "RecommendRestart":
                        restartNeeded = True
                    if showRemovalDetail:
                        item["display_name"] = ((item.get("display_name") or item.get("name", ""))
                                                + NSLocalizedString(u" (will be removed)", None))
                        item["description"] = NSLocalizedString(u"This item will be removed.", None)
                        updatelist.append(item)
                if not showRemovalDetail:
                    row = {}
                    row["display_name"] = NSLocalizedString(u"Software removals", None)
                    row["version"] = ""
                    row["description"] = NSLocalizedString(u"Scheduled removal of managed software.", None)
                    if restartNeeded:
                        row["RestartAction"] = "RequireRestart"
                    updatelist.append(row)

        if updatelist:
            self._listofupdates = updatelist
            self.enableUpdateNowBtn_(YES)
            #self.performSelector_withObject_afterDelay_("enableUpdateNowBtn:", YES, 4)
            self.getOptionalInstalls()
        else:
            appleupdates = munki.getAppleUpdates()
            if appleupdates:
                munki.log("MSU", "appleupdates")
                self._listofupdates = appleupdates.get("AppleUpdates", [])
                self.update_view_controller.updateNowBtn.setEnabled_(YES)
                self.update_view_controller.optionalSoftwareBtn.setHidden_(YES)
            else:
                self.update_view_controller.updateNowBtn.setEnabled_(NO)
                self.getOptionalInstalls()
Example #2
0
    def getAvailableUpdates(self):
        updatelist = []
        installinfo = munki.getInstallInfo()
        if installinfo:
            updatelist = installinfo.get("managed_installs", [])
            if installinfo.get("removals"):
                removallist = installinfo.get("removals")
                restartNeeded = False
                showRemovalDetail = munki.getRemovalDetailPrefs()
                for item in removallist:
                    if item.get("RestartAction") == "RequireRestart" or item.get("RestartAction") == "RecommendRestart":
                        restartNeeded = True
                    if showRemovalDetail:
                        item["display_name"] = ((item.get("display_name") or item.get("name", ""))
                                                + NSLocalizedString(u" (will be removed)", None))
                        item["description"] = NSLocalizedString(u"This item will be removed.", None)
                        updatelist.append(item)
                if not showRemovalDetail:
                    row = {}
                    row["display_name"] = NSLocalizedString(u"Software removals", None)
                    row["version"] = ""
                    row["description"] = NSLocalizedString(u"Scheduled removal of managed software.", None)
                    if restartNeeded:
                        row["RestartAction"] = "RequireRestart"
                    updatelist.append(row)

        if updatelist:
            self._listofupdates = updatelist
            self.enableUpdateNowBtn_(YES)
            #self.performSelector_withObject_afterDelay_("enableUpdateNowBtn:", YES, 4)
            self.getOptionalInstalls()
        else:
            appleupdates = munki.getAppleUpdates()
            if appleupdates:
                munki.log("MSU", "appleupdates")
                self._listofupdates = appleupdates.get("AppleUpdates", [])
                self.update_view_controller.updateNowBtn.setEnabled_(YES)
                self.update_view_controller.optionalSoftwareBtn.setHidden_(YES)
            else:
                self.update_view_controller.updateNowBtn.setEnabled_(NO)
                self.getOptionalInstalls()
Example #3
0
    def getAvailableUpdates(self):
        updatelist = []
        installinfo = munki.getInstallInfo()
        if installinfo:
            updatelist = installinfo.get("managed_installs", [])
            for update in updatelist:
                force_install_after_date = update.get(
                    'force_install_after_date')
                if force_install_after_date:
                    # insert installation deadline into description
                    local_date = munki.discardTimeZoneFromDate(
                        force_install_after_date)
                    date_str = munki.stringFromDate(local_date)
                    forced_date_text = NSLocalizedString(
                        u"This item must be installed by ", None)
                    description = update["description"]
                    # prepend deadline info to description. This will fail if the description is HTML...
                    update[
                        "description"] = forced_date_text + date_str + "\n\n" + description

            if installinfo.get("removals"):
                removallist = installinfo.get("removals")
                restartNeeded = False
                showRemovalDetail = munki.getRemovalDetailPrefs()
                for item in removallist:
                    if item.get(
                            "RestartAction") == "RequireRestart" or item.get(
                                "RestartAction") == "RecommendRestart":
                        restartNeeded = True
                    if showRemovalDetail:
                        item["display_name"] = (
                            (item.get("display_name") or item.get("name", ""))
                            + NSLocalizedString(u" (will be removed)", None))
                        item["description"] = NSLocalizedString(
                            u"This item will be removed.", None)
                        updatelist.append(item)
                if not showRemovalDetail:
                    row = {}
                    row["display_name"] = NSLocalizedString(
                        u"Software removals", None)
                    row["version"] = ""
                    row["description"] = NSLocalizedString(
                        u"Scheduled removal of managed software.", None)
                    if restartNeeded:
                        row["RestartAction"] = "RequireRestart"
                    updatelist.append(row)

        if updatelist:
            self._sortUpdateList(updatelist)
            self._listofupdates = updatelist
            self.enableUpdateNowBtn_(YES)
            #self.performSelector_withObject_afterDelay_("enableUpdateNowBtn:", YES, 4)
            self.getOptionalInstalls()
        else:
            appleupdates = munki.getAppleUpdates()
            if appleupdates:
                munki.log("MSU", "appleupdates")
                self._listofupdates = appleupdates.get("AppleUpdates", [])
                self.update_view_controller.updateNowBtn.setEnabled_(YES)
                self.update_view_controller.optionalSoftwareBtn.setHidden_(YES)
            else:
                self._listofupdates = []
                self.update_view_controller.updateNowBtn.setEnabled_(NO)
                self.getOptionalInstalls()