def buildOptionalInstallsData(self): table = [] selfservedata = munki.readSelfServiceManifest() selfserve_installs = selfservedata.get('managed_installs', []) selfserve_uninstalls = selfservedata.get('managed_uninstalls', []) for item in self._optionalInstalls: row = {} row['enabled'] = objc.YES # current install state row['installed'] = item.get("installed", objc.NO) # user desired state row['managed'] = (item['name'] in selfserve_installs) row['original_managed'] = (item['name'] in selfserve_installs) row['itemname'] = item['name'] row['name'] = item.get("display_name") or item['name'] row['version'] = munki.trimVersionString( item.get("version_to_install")) row['description'] = item.get("description", "") if item.get("installer_item_size"): row['size'] = munki.humanReadable( item.get("installer_item_size")) elif item.get("installed_size"): row['size'] = munki.humanReadable(item.get("installed_size")) else: row['size'] = "" if row['installed']: if item.get("needs_update"): status = NSLocalizedString(u"Update available", None) elif item.get("will_be_removed"): status = NSLocalizedString(u"Will be removed", None) elif not item.get('uninstallable'): status = NSLocalizedString(u"Not removable", None) row['enabled'] = objc.NO else: row['size'] = "-" status = NSLocalizedString(u"Installed", None) else: status = "Not installed" if item.get("will_be_installed"): status = NSLocalizedString(u"Will be installed", None) elif 'licensed_seats_available' in item: if not item['licensed_seats_available']: status = NSLocalizedString( u"No available license seats", None) row['enabled'] = objc.NO elif item.get("note"): # some reason we can't install status = item.get("note") row['enabled'] = objc.NO row['status'] = status row['original_status'] = status row_dict = NSMutableDictionary.dictionaryWithDictionary_(row) table.append(row_dict) self.optional_view_controller.setOptionallist_(table) self.optional_view_controller.tableView.deselectAll_(self)
def buildOptionalInstallsData(self): table = [] selfservedata = munki.readSelfServiceManifest() selfserve_installs = selfservedata.get('managed_installs', []) selfserve_uninstalls = selfservedata.get('managed_uninstalls', []) for item in self._optionalInstalls: row = {} row['enabled'] = objc.YES # current install state row['installed'] = item.get("installed", objc.NO) # user desired state row['managed'] = (item['name'] in selfserve_installs) row['original_managed'] = (item['name'] in selfserve_installs) row['itemname'] = item['name'] row['name'] = item.get("display_name") or item['name'] row['version'] = munki.trimVersionString( item.get("version_to_install")) row['description'] = item.get("description", "") if item.get("installer_item_size"): row['size'] = munki.humanReadable( item.get("installer_item_size")) elif item.get("installed_size"): row['size'] = munki.humanReadable(item.get("installed_size")) else: row['size'] = "" if row['installed']: if item.get("needs_update"): status = NSLocalizedString(u"Update available", None) else: row['size'] = "-" status = NSLocalizedString(u"Installed", None) if item.get("will_be_removed"): status = NSLocalizedString(u"Will be removed", None) elif not item.get('uninstallable'): status = NSLocalizedString(u"Not removable", None) row['enabled'] = objc.NO else: status = "Not installed" if item.get("will_be_installed"): status = NSLocalizedString(u"Will be installed", None) elif item.get("note"): # some reason we can't install status = item.get("note") row['enabled'] = objc.NO row['status'] = status row['original_status'] = status row_dict = NSMutableDictionary.dictionaryWithDictionary_(row) table.append(row_dict) self.optional_view_controller.setOptionallist_(table) self.optional_view_controller.tableView.deselectAll_(self)
def __init__(self): self._installs = set(munki.readSelfServiceManifest().get( 'managed_installs', [])) self._uninstalls = set(munki.readSelfServiceManifest().get( 'managed_uninstalls', []))
def __init__(self): self._installs = set( munki.readSelfServiceManifest().get('managed_installs', [])) self._uninstalls = set( munki.readSelfServiceManifest().get('managed_uninstalls', []))