def __init__(self, screen, tui): if not rhnreg.registered() or tui.test: raise WindowSkipException() self.screen = screen self.tui = tui size = snack._snack.size() systemIdXml = rpclib.xmlrpclib.loads(up2dateAuth.getSystemId()) oldUsername = systemIdXml[0][0]['username'] oldsystemId = systemIdXml[0][0]['system_id'] toplevel = snack.GridForm(self.screen, sstr(SYSTEM_ALREADY_SETUP), 1, 2) self.bb = snack.ButtonBar(self.screen, [(sstr(YES_CONT), "next"), (sstr(NO_CANCEL), "exit")]) toplevel.add(self.bb, 0, 1, growx = 1) tb = snack.Textbox(size[0]-30, size[1]-20, sstr(SYSTEM_ALREADY_REGISTERED + "\n\n" + _("Spacewalk Location:") + " " + convert_url_from_puny(self.tui.serverURL) + "\n" + _("Login:"******" " + oldUsername + "\n" + _("System ID:") + " " + oldsystemId + "\n\n" + SYSTEM_ALREADY_REGISTERED_CONT + "\n"), 1, 1) toplevel.add(tb, 0, 0, padding = (0, 0, 0, 1)) self.g = toplevel
def _getVbox(self): if rhnreg.registered(): self.start_page = KsRegisteredPage() return self.start_page.startPageVbox() if _haveNetwork(): self.start_page = rhnregGui.StartPage(firstboot=True) else: self.start_page = NoNetworkPage() return self.start_page.startPageVbox()
def _getVbox(self): if rhnreg.registered(): self.start_page = KsRegisteredPage() return self.start_page.startPageVbox() if self.parent.checkNetwork(): self.start_page = rhnregGui.StartPage(firstboot=True) else: self.start_page = NoNetworkPage() return self.start_page.startPageVbox()
def onStartPagePrepare(self, mainWin, vbox, manualPrepare=False): if rhnreg.rhsm_registered() and not self.rhsm_already_registered_already_shown: # Dialog constructor returns when dialog closes dialog = rhnregGui.AlreadyRegisteredSubscriptionManagerDialog() if dialog.rc == 0: sys.exit(0) self.rhsm_already_registered_already_shown = True if rhnreg.registered() and not self.already_registered_already_shown: # Dialog constructor returns when dialog closes dialog = rhnregGui.AlreadyRegisteredDialog() if dialog.rc == 0: sys.exit(0) self.already_registered_already_shown = True
def _system_is_registered(self): if rhnreg.registered() or rhnreg.rhsm_registered(): return True try: _rhsm_path = "/usr/share/rhsm/subscription_manager" _rhsm_path_added = False if _rhsm_path not in sys.path: sys.path.append(_rhsm_path) _rhsm_path_added = True import certlib if _rhsm_path_added: sys.path.remove(_rhsm_path) return certlib.ConsumerIdentity.existsAndValid() except: return False
def onStartPagePrepare(self, page, dummy, manualPrepare=False): if not manualPrepare: self.startPage.emit_stop_by_name("prepare") self.druid.set_buttons_sensitive(False, True, True, False) if rhnreg.rhsm_registered() and not self.rhsm_already_registered_already_shown: # Dialog constructor returns when dialog closes dialog = rhnregGui.AlreadyRegisteredSubscriptionManagerDialog() if dialog.rc == 0: sys.exit(0) self.rhsm_already_registered_already_shown = True if rhnreg.registered() and not self.already_registered_already_shown: # Dialog constructor returns when dialog closes dialog = rhnregGui.AlreadyRegisteredDialog() if dialog.rc == 0: sys.exit(0) self.already_registered_already_shown = True
def shouldAppear(self): if rhnreg.registered(): return False return True
def main(self): if self.options.serverUrl: rhnreg.cfg.set("serverURL", self.options.serverUrl) if self.options.sslCACert: rhnreg.cfg.set("sslCACert", self.options.sslCACert) if not (self.options.activationkey or (self.options.username and self.options.password)): print _("A username and password are required "\ "to register a system.") sys.exit(-1) if rhnreg.registered() and not self.options.force: print _("This system is already registered. Use --force to override") sys.exit(-1) rhnreg.getCaps() if not self.options.nopackages: getArch = 0 if rhnreg.cfg['supportsExtendedPackageProfile']: getArch = 1 packageList = pkgUtils.getInstalledPackageList(getArch=getArch) else: packageList = [] hardwareList = hardware.Hardware() if self.options.profilename: profilename = self.options.profilename else: profilename = RegisterKsCli.__generateProfileName(hardwareList) other = {} if self.options.systemorgid: other['org_id'] = self.options.systemorgid # Try to get the virt uuid and put it in "other". (virt_uuid, virt_type) = rhnreg.get_virt_info() if not virt_uuid is None: other['virt_uuid'] = virt_uuid other['virt_type'] = virt_type # If specified, send up the EUS channel label for subscription. if self.options.use_eus_channel: if self.options.activationkey: print _("Usage of --use-eus-channel option with --activationkey is not supported. Please use username and password instead.") sys.exit(-1) if not rhnreg.server_supports_eus(): print _("The server you are registering against does not support EUS.") sys.exit(-1) channels = rhnreg.getAvailableChannels(self.options.username, self.options.password) other['channel'] = channels['default_channel'] try: if self.options.activationkey: systemId = rhnreg.registerSystem(token = self.options.activationkey, profileName = profilename, other = other) else: systemId = rhnreg.registerSystem(self.options.username, self.options.password, profilename, other = other) except (up2dateErrors.AuthenticationTicketError, up2dateErrors.RhnUuidUniquenessError, up2dateErrors.CommunicationError, up2dateErrors.AuthenticationOrAccountCreationError), e: print "%s" % e.errmsg sys.exit(1)
def main(self): if self.options.serverUrl: rhnreg.cfg.set("serverURL", self.options.serverUrl) if self.options.sslCACert: rhnreg.cfg.set("sslCACert", self.options.sslCACert) if not (self.options.activationkey or (self.options.username and self.options.password)): print _("A username and password are required "\ "to register a system.") sys.exit(-1) if rhnreg.registered() and not self.options.force: print _("This system is already registered. Use --force to override") sys.exit(-1) rhnreg.getCaps() if not self.options.nopackages: getArch = 0 if rhnreg.cfg['supportsExtendedPackageProfile']: getArch = 1 packageList = pkgUtils.getInstalledPackageList(getArch=getArch) else: packageList = [] hardwareList = hardware.Hardware() if self.options.profilename: profilename = self.options.profilename else: profilename = RegisterKsCli.__generateProfileName(hardwareList) other = {} if self.options.systemorgid: other['org_id'] = self.options.systemorgid # Try to get the virt uuid and put it in "other". (virt_uuid, virt_type) = rhnreg.get_virt_info() if not virt_uuid is None: other['virt_uuid'] = virt_uuid other['virt_type'] = virt_type # If specified, send up the EUS channel label for subscription. if self.options.use_eus_channel: if self.options.activationkey: print _("Usage of --use-eus-channel option with --activationkey is not supported. Please use username and password instead.") sys.exit(-1) if not rhnreg.server_supports_eus(): print _("The server you are registering against does not support EUS.") sys.exit(-1) channels = rhnreg.getAvailableChannels(self.options.username, self.options.password) other['channel'] = channels['default_channel'] try: if self.options.activationkey: systemId = rhnreg.registerSystem(token = self.options.activationkey, profileName = profilename, other = other) else: systemId = rhnreg.registerSystem(self.options.username, self.options.password, profilename, other = other) except (up2dateErrors.AuthenticationTicketError, up2dateErrors.RhnUuidUniquenessError, up2dateErrors.CommunicationError, up2dateErrors.AuthenticationOrAccountCreationError): e = sys.exc_info()[1] print "%s" % e.errmsg sys.exit(1) # collect hardware info, inluding hostname if not self.options.nohardware: rhnreg.sendHardware(systemId, hardwareList) if not self.options.nopackages: rhnreg.sendPackages(systemId, packageList) if self.options.contactinfo: print _("Warning: --contactinfo option has been deprecated. Please login to the server web user Interface and update your contactinfo. ") # write out the new id if isinstance(systemId, unicode): rhnreg.writeSystemId(unicode.encode(systemId, 'utf-8')) else: rhnreg.writeSystemId(systemId) # assume successful communication with server # remember to save the config options rhnreg.cfg.save() # Send virtualization information to the server. We must do this # *after* writing out the system id. if not self.options.novirtinfo: rhnreg.sendVirtInfo(systemId) # do this after writing out system id, bug #147513 if not self.options.norhnsd: rhnreg.startRhnsd() try: present, conf_changed = rhnreg.pluginEnable() if not present: sys.stderr.write(rhncli.utf8_encode(_("Warning: %s is not present, could not enable it.") % PM_PLUGIN_NAME)) except IOError: e = sys.exc_info()[1] sys.stderr.write(rhncli.utf8_encode(_("Warning: Could not open %s\n%s is not enabled.\n") % (PM_PLUGIN_CONF, PM_PLUGIN_NAME) + e.errmsg)) RegisterKsCli.__runRhnCheck(self.options.verbose)
def __init__(self): RhnRegisterFirstbootGuiWindow.__init__(self) rhnregGui.LoginPage.__init__(self) if rhnreg.registered(): self.skipme = True
def __init__(self): RhnRegisterFirstbootGuiWindow.__init__(self) rhnregGui.ReviewSubscriptionPage.__init__(self) if rhnreg.registered(): self.skipme = True
def __init__(self): RhnRegisterFirstbootGuiWindow.__init__(self) rhnregGui.ProvideCertificatePage.__init__(self) if rhnreg.registered(): self.skipme = True
def __init__(self): RhnRegisterFirstbootGuiWindow.__init__(self) rhnregGui.CreateProfilePage.__init__(self) if rhnreg.registered(): self.skipme = True
def shouldAppear(self): return not rhnreg.registered()
def main(self): if self.options.serverUrl: rhnreg.cfg.set("serverURL", self.options.serverUrl) if self.options.sslCACert: rhnreg.cfg.set("sslCACert", self.options.sslCACert) if not (self.options.activationkey or (self.options.username and self.options.password)): print _("A username and password are required "\ "to register a system.") sys.exit(-1) if rhnreg.registered() and not self.options.force: print _( "This system is already registered. Use --force to override") sys.exit(-1) rhnreg.getCaps() if not self.options.nopackages: getArch = 0 if rhnreg.cfg['supportsExtendedPackageProfile']: getArch = 1 packageList = pkgUtils.getInstalledPackageList(getArch=getArch) else: packageList = [] hardwareList = hardware.Hardware() if self.options.profilename: profilename = self.options.profilename else: profilename = RegisterKsCli.__generateProfileName(hardwareList) other = {} if self.options.systemorgid: other['org_id'] = self.options.systemorgid # Try to get the virt uuid and put it in "other". (virt_uuid, virt_type) = rhnreg.get_virt_info() if not virt_uuid is None: other['virt_uuid'] = virt_uuid other['virt_type'] = virt_type # If specified, send up the EUS channel label for subscription. if self.options.use_eus_channel: if self.options.activationkey: print _( "Usage of --use-eus-channel option with --activationkey is not supported. Please use username and password instead." ) sys.exit(-1) if not rhnreg.server_supports_eus(): print _( "The server you are registering against does not support EUS." ) sys.exit(-1) channels = rhnreg.getAvailableChannels(self.options.username, self.options.password) other['channel'] = channels['default_channel'] try: systemId = rhnreg.registerSystem(self.options.username, self.options.password, profilename, self.options.activationkey, other) except (up2dateErrors.AuthenticationTicketError, up2dateErrors.RhnUuidUniquenessError, up2dateErrors.CommunicationError, up2dateErrors.AuthenticationOrAccountCreationError): e = sys.exc_info()[1] print "%s" % e.errmsg sys.exit(1) # collect hardware info, inluding hostname if not self.options.nohardware: rhnreg.sendHardware(systemId, hardwareList) if not self.options.nopackages: rhnreg.sendPackages(systemId, packageList) if self.options.contactinfo: print _( "Warning: --contactinfo option has been deprecated. Please login to the server web user Interface and update your contactinfo. " ) # write out the new id if isinstance(systemId, unicode): rhnreg.writeSystemId(unicode.encode(systemId, 'utf-8')) else: rhnreg.writeSystemId(systemId) # assume successful communication with server # remember to save the config options rhnreg.cfg.save() # Send virtualization information to the server. We must do this # *after* writing out the system id. if not self.options.novirtinfo: rhnreg.sendVirtInfo(systemId) # do this after writing out system id, bug #147513 if not self.options.norhnsd: rhnreg.startRhnsd() try: present, conf_changed = rhnreg.pluginEnable() if not present: sys.stderr.write( rhncli.utf8_encode( _("Warning: %s is not present, could not enable it.") % PM_PLUGIN_NAME)) except IOError: e = sys.exc_info()[1] sys.stderr.write( rhncli.utf8_encode( _("Warning: Could not open %s\n%s is not enabled.\n") % (PM_PLUGIN_CONF, PM_PLUGIN_NAME) + e.errmsg)) RegisterKsCli.__runRhnCheck(self.options.verbose)
def __init__(self): RhnRegisterFirstbootGuiWindow.__init__(self) rhnregGui.ChooseServerPage.__init__(self) if rhnreg.registered(): self.skipme = True