def __init__(self, screen, tui): self.name = "PackagesWindow" self.screen = screen self.tui = tui size = snack._snack.size() toplevel = snack.GridForm(screen, PACKAGES_WINDOW.encode('utf-8'), 1, 5) self.g = toplevel text = snack.TextboxReflowed(size[0] - 10, PACKAGES_WINDOW_DESC1.encode('utf-8')) toplevel.add(text, 0, 0, anchorLeft=1) self.packagesButton = snack.Checkbox( PACKAGES_WINDOW_DESC2.encode('utf-8'), 1) toplevel.add(self.packagesButton, 0, 1, padding=(0, 1, 0, 1), anchorLeft=1) label = snack.Label(PACKAGES_WINDOW_UNCHECK.encode('utf-8')) toplevel.add(label, 0, 2, anchorLeft=1) #self.packageList = snack.Listbox(size[1]-18, 1, width = size[0]-10) self.packageList = snack.CheckboxTree(size[1] - 18, 1) toplevel.add(self.packageList, 0, 3) # do we need to read the packages from disk? if tui.packageList == []: self.pwin = snack.GridForm(screen, PACKAGES_WINDOW_PKGLIST.encode('utf-8'), 1, 1) self.scale = snack.Scale(40, 100) self.pwin.add(self.scale, 0, 0) self.pwin.draw() self.screen.refresh() getArch = 0 if rhnreg.cfg['supportsExtendedPackageProfile']: getArch = 1 tui.packageList = pkgUtils.getInstalledPackageList(getArch=getArch) self.screen.popWindow() for package in tui.packageList: self.packageList.append( "%s-%s-%s" % (package['name'], package['version'], package['release']), item=package['name'], selected=1) # BUTTON BAR self.bb = snack.ButtonBar(screen, [(NEXT.encode('utf-8'), "next"), (BACK.encode('utf-8'), "back"), (CANCEL.encode('utf-8'), "cancel")]) toplevel.add(self.bb, 0, 4, padding=(0, 1, 0, 0), growx=1)
def updatePackageProfile(timeout=None): """ get a list of installed packages and send it to rhnServer """ log = up2dateLog.initLog() log.log_me("Updating package profile") packages = pkgUtils.getInstalledPackageList(getArch=1) s = rhnserver.RhnServer(timeout=timeout) if not s.capabilities.hasCapability('xmlrpc.packages.extended_profile', 2): # for older satellites and hosted - convert to old format packages = convertPackagesFromHashToList(packages) s.registration.update_packages(up2dateAuth.getSystemId(), packages)
def updatePackageProfile(): """ get a list of installed packages and send it to rhnServer """ log = up2dateLog.initLog() log.log_me("Updating package profile") packages = pkgUtils.getInstalledPackageList(getArch=1) s = rhnserver.RhnServer() if not s.capabilities.hasCapability('xmlrpc.packages.extended_profile', 2): # for older satellites and hosted - convert to old format packages = convertPackagesFromHashToList(packages) s.registration.update_packages(up2dateAuth.getSystemId(), packages)
def __init__(self, screen, tui): self.name = "PackagesWindow" self.screen = screen self.tui = tui size = snack._snack.size() toplevel = snack.GridForm(screen, PACKAGES_WINDOW.encode('utf-8'), 1, 5) self.g = toplevel text = snack.TextboxReflowed(size[0]-10, PACKAGES_WINDOW_DESC1.encode('utf-8')) toplevel.add(text, 0, 0, anchorLeft = 1) self.packagesButton = snack.Checkbox(PACKAGES_WINDOW_DESC2.encode('utf-8'), 1) toplevel.add(self.packagesButton, 0, 1, padding = (0, 1, 0, 1), anchorLeft = 1) label = snack.Label(PACKAGES_WINDOW_UNCHECK.encode('utf-8')) toplevel.add(label, 0, 2, anchorLeft = 1) #self.packageList = snack.Listbox(size[1]-18, 1, width = size[0]-10) self.packageList = snack.CheckboxTree(size[1]-18, 1) toplevel.add(self.packageList, 0, 3) # do we need to read the packages from disk? if tui.packageList == []: self.pwin = snack.GridForm(screen, PACKAGES_WINDOW_PKGLIST.encode('utf-8'), 1, 1) self.scale = snack.Scale(40, 100) self.pwin.add(self.scale, 0, 0) self.pwin.draw() self.screen.refresh() getArch = 0 if rhnreg.cfg['supportsExtendedPackageProfile']: getArch = 1 tui.packageList = pkgUtils.getInstalledPackageList(getArch=getArch) self.screen.popWindow() for package in tui.packageList: self.packageList.append("%s-%s-%s" % (package['name'], package['version'], package['release']), item = package['name'], selected = 1) # BUTTON BAR self.bb = snack.ButtonBar(screen, [(NEXT.encode('utf-8'), "next"), (BACK.encode('utf-8'), "back"), (CANCEL.encode('utf-8'), "cancel")]) toplevel.add(self.bb, 0, 4, padding = (0, 1, 0, 0), growx = 1)
def updatePackages(systemId): s = rhnserver.RhnServer() s.registration.add_packages(systemId, pkgUtils.getInstalledPackageList())