client/rhel/rhn-client-tools/data/gui.glade | 24
client/rhel/rhn-client-tools/rhn-client-tools.spec | 1
client/rhel/rhn-client-tools/src/firstboot/Makefile | 2
client/rhel/rhn-client-tools/src/firstboot/rhn_activate_gui.py | 75 --
client/rhel/rhn-client-tools/src/up2date_client/gui.py | 2
client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py | 76 --
client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py | 299 ----------
7 files changed, 29 insertions(+), 450 deletions(-)
New commits:
commit 5efbb06f15a24281e2f940fd08542b4f7276c12a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Mar 31 13:53:20 2010 +0200
Make sure activate_hardware_info is called before available_eus_channels.
The activate_hardware_info can actually give the account the
entitlements it would need to access z stream/eus.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/gui.py
b/client/rhel/rhn-client-tools/src/up2date_client/gui.py
index 4b0ce37..b852914 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/gui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/gui.py
@@ -225,7 +225,7 @@ class Gui(rhnregGui.StartPage, rhnregGui.ChooseServerPage,
rhnregGui.LoginPage,
"""This function is used by the create new account dialog so it
doesn't
need to have any knowledge of the screen mechanism or order.
"""
- if rhnregGui.chooseChannelShouldBeShown():
+ if rhnregGui.ChooseChannelPage.chooseChannelShouldBeShown(self):
self.druid.set_page(self.chooseChannelPage)
else:
self.druid.set_page(self.createProfilePage)
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index 17acf62..ceef399 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -524,30 +524,6 @@ class ConfirmAllUpdatesDialog:
self.dialog.destroy()
-def chooseChannelShouldBeShown():
- '''
- Returns True if the choose channel window should be shown, else
- returns False.
- '''
-
- # First and foremost, we should try to activate hardware
- try_to_activate_hardware()
-
- # Second and foremost, does the server support eus?
- if rhnreg.server_supports_eus():
-
- global username, password
-
- channels = rhnreg.getAvailableChannels(username, password)
-
- channels = channels['channels']
-
- if len(channels) > 0:
- return True
- else:
- return False
-
-
class ChooseChannelPage:
def __init__(self):
self.chooseChannelXml = gtk.glade.XML(gladefile,
@@ -570,7 +546,7 @@ class ChooseChannelPage:
global username, password
- self.eus_channels = rhnreg.getAvailableChannels(username, password)
+ # The self.eus_channels was populated in chooseChannelShouldBeShown
self.channels = self.eus_channels['channels']
self.receiving_updates = self.eus_channels['receiving_updates']
@@ -616,6 +592,28 @@ class ChooseChannelPage:
else:
self.chose_all_updates = True
+ def chooseChannelShouldBeShown(self):
+ '''
+ Returns True if the choose channel window should be shown, else
+ returns False.
+ '''
+
+ # First and foremost, we should try to activate hardware
+ try_to_activate_hardware()
+
+ # Second and foremost, does the server support eus?
+ if rhnreg.server_supports_eus():
+
+ global username, password
+
+ self.eus_channels = rhnreg.getAvailableChannels(username, password)
+
+ if len(self.eus_channels['channels']) > 0:
+ return True
+ else:
+ return False
+
+
class CreateProfilePage:
def __init__(self):
self.createProfileXml = gtk.glade.XML(gladefile,
commit 7339d0527911cf537d4359e73c40e3bce98a16a8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:16:03 2010 +0200
Widget activateSubscriptionPage no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/data/gui.glade
b/client/rhel/rhn-client-tools/data/gui.glade
index a69df88..93608b1 100644
--- a/client/rhel/rhn-client-tools/data/gui.glade
+++ b/client/rhel/rhn-client-tools/data/gui.glade
@@ -101,30 +101,6 @@
</child>
<child>
- <widget class="GnomeDruidPageStandard"
id="activateSubscriptionPage">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Access a
subscription</property>
- <property name="logo">shadowman-round-48.png</property>
- <signal name="next"
handler="onActivateSubscriptionPageNext"/>
- <signal name="back"
handler="onActivateSubscriptionPageBack"/>
- <signal name="prepare"
handler="onActivateSubscriptionPagePrepare"/>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="linkToSubscriptionPageVbox">
- <property name="border_width">16</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
<widget class="GnomeDruidPageStandard"
id="chooseChannelPage">
<property name="visible">True</property>
<property name="title" translatable="yes">Select operating
system release</property>
commit dea799ecd47d1bea64d5b24ea972afb70a565d18
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:15:11 2010 +0200
Class ActivateSubscriptionPage no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index 5b74628..17acf62 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -497,108 +497,6 @@ class LoginPage:
return False
-class ActivateSubscriptionPage:
- """The screen that allows activation a installation number.
-
- activateSubscriptionShouldBeShown() should be used to decide whether to show
- this page or not.
-
- """
- def __init__(self):
- self.activateSubscriptionNoneXml = gtk.glade.XML(gladefile,
-
"activateSubscriptionNoneWindowVbox",
- domain="rhn-client-tools")
- self.activateSubscriptionNoneVbox = \
- self.activateSubscriptionNoneXml.get_widget(
- "activateSubscriptionNoneWindowVbox")
- self.registrationNumberEntry = \
- self.activateSubscriptionNoneXml.get_widget(
- "registrationNumberEntry")
- self.registrationNumberStatusLabel = \
- self.activateSubscriptionNoneXml.get_widget(
- "registrationNumberStatusLabel")
- self.registrationNumberEntry.connect("changed",
- self.activateSubscriptionPageRegistrationNumberChanged)
- self.activatedRegNums = []
-
- def activateSubscriptionPageVbox(self):
- return self.activateSubscriptionNoneVbox
-
- def activateSubscriptionPagePrepare(self):
- # We need to call this manually otherwise it won't say the number's been
- # activated when they click back from the create profile page until they
- # change it.
- self.activateSubscriptionPageRegistrationNumberChanged()
-
- def activateSubscriptionPageVerify(self):
- """Returns False if everything is ok. Returns True if there's
a problem
- and the user was notified.
-
- """
- newRegNum = self.registrationNumberEntry.get_text()
- if newRegNum == "":
- errorWindow(_("You must enter an installation number."))
- self.registrationNumberEntry.grab_focus()
- return True
- return False
-
- def activateSubscriptionPageApply(self):
- """Returns False if everything is ok. Returns True if there's
a problem
- and the user was notified.
-
- """
- status = callAndFilterExceptions(
- self._activateSubscriptionPageApply,
- [],
- _("There was an error activating your number.")
- )
- # Need to handle a filtering returning None
- if status is False:
- return False
- else:
- return True
-
- def _activateSubscriptionPageApply(self):
- """See comment for
activateSubscriptionPageApply."""
- global username, password, organization, regNum
- regNum = self.registrationNumberEntry.get_text()
- if regNum not in self.activatedRegNums:
- try:
- setBusyCursor()
- result = rhnreg.activateRegistrationNumber(username, password,
- regNum, organization)
- except up2dateErrors.InvalidRegistrationNumberError:
- setArrowCursor()
- errorWindow(rhnreg_constants.INVALID_NUMBER % regNum)
- return True
- except up2dateErrors.NotEntitlingError:
- setArrowCursor()
- errorWindow(rhnreg_constants.NONENTITLING_NUMBER)
- return True
- setArrowCursor()
- if result.getStatus() == ActivationResult.ALREADY_USED:
- errorWindow(rhnreg_constants.ALREADY_USED_NUMBER)
- return True
- else:
- assert result.getStatus() == ActivationResult.ACTIVATED_NOW
- reviewLog.activatedRegistrationNumber(regNum, result)
- self.activatedRegNums.append(regNum)
- rhnreg.writeRegNum(regNum)
- else:
- log.debug_log("Skipping activation because this number has already
"
- "been activated.")
- return False
-
- def activateSubscriptionPageRegistrationNumberChanged(self, entry=None):
- newRegNum = self.registrationNumberEntry.get_text()
- if newRegNum in self.activatedRegNums:
- status = _("This installation number has already been activated.")
- else:
- status = ""
- status = "<small><i>%s</i></small>" % status
- self.registrationNumberStatusLabel.set_label(status)
-
-
class ReviewSubscriptionPage:
def __init__(self):
self.reviewSubscriptionXml = gtk.glade.XML(gladefile,
commit 3fd61370860bcf272e519a0537297c26b5ce3386
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:14:04 2010 +0200
rhn_activate_gui no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec
b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index 82a4e7e..a238a0d 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -214,7 +214,6 @@ make -f Makefile.rhn-client-tools test
# firstboot is smart enough now to skip these modules
# if the modules say to
-%{_datadir}/firstboot/modules/rhn_activate_gui.*
%{_datadir}/firstboot/modules/rhn_login_gui.*
%{_datadir}/firstboot/modules/rhn_register_firstboot_gui_window.*
%{_datadir}/firstboot/modules/rhn_start_gui.*
diff --git a/client/rhel/rhn-client-tools/src/firstboot/Makefile
b/client/rhel/rhn-client-tools/src/firstboot/Makefile
index 0a9a461..bbd6365 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/Makefile
+++ b/client/rhel/rhn-client-tools/src/firstboot/Makefile
@@ -3,7 +3,7 @@
# $Id$
MODULES = rhn_login_gui \
- rhn_activate_gui rhn_register_firstboot_gui_window \
+ rhn_register_firstboot_gui_window \
rhn_start_gui rhn_choose_server_gui \
rhn_provide_certificate_gui rhn_create_profile_gui \
rhn_review_gui rhn_finish_gui
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_activate_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_activate_gui.py
deleted file mode 100644
index 13eec7c..0000000
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_activate_gui.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# rhn_register.py - GUI front end code for firstboot screen resolution
-#
-# Copyright 2003 Red Hat, Inc.
-# Copyright 2003 Brent Fox <bfox(a)redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-import gtk
-import gobject
-import sys
-import os
-import functions
-
-import gnome, gnome.ui
-from gtk import glade
-
-from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
-sys.path.insert(0, "/usr/share/rhn/up2date_client/")
-sys.path.insert(1,"/usr/share/rhn")
-
-import rhnreg
-import rhnregGui
-import up2dateErrors
-import messageWindow
-
-import gettext
-_ = gettext.gettext
-
-gettext.textdomain("rhn-client-tools")
-gtk.glade.bindtextdomain("rhn-client-tools")
-
-
-class RhnActivateWindow(RhnRegisterFirstbootGuiWindow,
rhnregGui.ActivateSubscriptionPage):
- #You must specify a runPriority for the order in which you wish your module to run
- runPriority = 108.5
- moduleName = _("Access Subscription")
- windowTitle = moduleName
- shortMessage = _("Connect to Red Hat Network")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
-
- def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.ActivateSubscriptionPage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
-
- def updatePage(self):
- self.activateSubscriptionPagePrepare()
-
- def _getVbox(self):
- return self.activateSubscriptionPageVbox()
-
- def apply(self, *args):
- """Returns None if the page shouldn't be
advanced."""
- ret = self.activateSubscriptionPageVerify()
- if ret:
- return None
- return True
-
-childWindow = RhnActivateWindow
commit f4773009300f3ef6a7d515676c94a012fa1c1e49
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:11:42 2010 +0200
getRemainingSubscriptions no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index 11613dc..3b0ab50 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -496,50 +496,6 @@ def sat_supports_virt_guest_registration():
return False
-def getRemainingSubscriptions(username, password):
-
- s = rhnserver.RhnServer()
- server_type = getServerType()
-
- # The only point of this function is to determine if we should show the
- # Activate a Subscription screen, which we never do in satellite.
- if server_type == 'satellite':
- return 1
-
- arch = up2dateUtils.getArch()
- #Intentionally swapping, release/version so it is more in tune
- #with the perspective of release/version used by RHN Hosted.
- #bz: 442694
- release = up2dateUtils.getVersion()
- version = up2dateUtils.getRelease()
-
- virt_uuid, virt_type = get_virt_info()
- if virt_uuid is not None:
- log.log_debug('Sending up virt_uuid: %s' % str(virt_uuid))
- else:
- virt_uuid = ""
-
- # If we've gotten this far, we're definitely looking at hosted.
- # Hosted will have to support the sending of the release, and optionally,
- # the virt_uuid.
-
- if cfg['supportsSMBIOS']:
- smbios = hardware.get_smbios()
- subs = s.registration.remaining_subscriptions(username, password,
- arch,
- release,
- virt_uuid,
- smbios)
- else:
- subs = s.registration.remaining_subscriptions(username, password,
- arch,
- release,
- virt_uuid)
-
-
- log.log_debug('Server returned %s' % subs)
- return subs
-
def sendHardware(systemId, hardwareList):
s = rhnserver.RhnServer()
s.registration.add_hw_profile(systemId, hardwareList)
commit 3b95478ec9aecaf349867705cf7f3fbcf672ef2b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:10:32 2010 +0200
autoActivatedRegistrationNumber and foundRegNumButCouldntActivate no longer used,
removing.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index a1f23a4..5b74628 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -113,23 +113,6 @@ class ReviewLog:
def getTextBuffer(self):
return self._text
- def foundRegNumButCouldntActivate(self):
- self.addBoldText(_("Notice"))
- self.addText(rhnreg_constants.INST_NUM_ON_DISK)
- self.addText('') # adds newline
-
- def autoActivatedRegistrationNumber(self, registrationNumber,
- activationResult):
- self.addBoldText(_("Automatic Subscription Activation"))
- text = rhnreg_constants.SUB_NUM % registrationNumber
- text = text + ' ' + rhnreg_constants.SUB_NUM_RESULT
- self.addText(text)
- for channel, quantity in activationResult.getChannelsActivated().items():
- self.addBulletedText("%s (%s)" % (channel, quantity))
- for service, quantity in activationResult.getSystemSlotsActivated().items():
- self.addBulletedText("%s (%s)" % (service, quantity))
- self.addText('') # adds newline
-
def autoActivatedHardwareInfo(self, activationResult):
self.addBoldText(_("Automatic Subscription Activation"))
text = rhnreg_constants.SUB_NUM % activationResult.getRegistrationNumber()
commit e195fc7aea3d5b642ee212fbdc224bc8d672a286
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:06:53 2010 +0200
getAvailableSubscriptions no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index 0c9a4a6..11613dc 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -540,38 +540,6 @@ def getRemainingSubscriptions(username, password):
log.log_debug('Server returned %s' % subs)
return subs
-def getAvailableSubscriptions(username, password):
- """Higher level and more convenient version of
getRemainingSubscriptions.
-
- Precondition: getCaps() was called.
-
- Returns: -1 for inifinite subscriptions.
-
- Raises:
- * up2dateErrors.ServerCapabilityError
- * up2dateErrors.ValidationError
- probably others
-
- """
- availableSubscriptions = None
-
- log.log_debug('Calling getAvailableSubscriptions')
-
- if cfg['supportsRemainingSubscriptions'] is None:
- message = "The server doesn't support the " \
- "registration.remaining_subscriptions call which is needed."
- raise up2dateErrors.ServerCapabilityError(message)
-
- try:
- availableSubscriptions = \
- getRemainingSubscriptions(username, password)
- except up2dateErrors.NoBaseChannelError, e:
- availableSubscriptions = 0
- log.log_debug('NoBaseChannelError raised.')
- log.log_debug('Returning %s available subscriptions.' %
- availableSubscriptions)
- return availableSubscriptions
-
def sendHardware(systemId, hardwareList):
s = rhnserver.RhnServer()
s.registration.add_hw_profile(systemId, hardwareList)
commit cb4b39f72d386014c85fb48602a9a70ae7125014
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:05:42 2010 +0200
autoActivateNumbersOnce no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index 8fd2370..a1f23a4 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -1489,86 +1489,6 @@ def callAndFilterExceptions(function, allowedExceptions,
errorHandler(disallowedExceptionMessage,
(exceptionType, exception, stackTrace))
-def autoActivateNumbersOnce():
- """Activates the registration/installation number from disk and the
hardware
- info from the bios.
-
- Returns two values. They will be ActivationResults for the registration
- number from disk and the hardware info respectively if the activations
- happened. Each value will be None if that activation didn't take place or
- there was an error. If this call is made more than once, every call after
- the first will return (None, None).
-
- If something is activated, the resulting reg num will be stored so it will
- be used when creating the system profile (for child channels). A number
- from disk takes precedence over hardware info if both are activated.
-
- Can raise CommunicationError.
-
- """
- global _autoActivatedNumbers, regNum
- if _autoActivatedNumbers:
- return (None, None)
- _autoActivatedNumbers = True
-
- log.log_debug("Trying to automatically activate stuff.")
-
- activateHWResult = None
- if serverType == 'hosted':
- hardwareInfo = None
- try:
- hardwareInfo = hardware.get_hal_system_and_smbios()
- except:
- log.log_me("There was an error while reading the hardware info from
"
- "the bios. Traceback:\n")
- log.log_exception(*sys.exc_info())
- if hardwareInfo:
- try:
- activateHWResult = rhnreg.activateHardwareInfo(username, password,
- hardwareInfo, organization)
- if activateHWResult.getStatus() == ActivationResult.ACTIVATED_NOW:
- reviewLog.autoActivatedHardwareInfo(activateHWResult)
- regNum = activateHWResult.getRegistrationNumber()
- rhnreg.writeRegNum(regNum)
- except up2dateErrors.NotEntitlingError:
- log.log_debug('There are are no entitlements associated with this
'
- 'hardware.')
- except up2dateErrors.InvalidRegistrationNumberError:
- log.log_debug('The hardware id was not recognized as valid.')
-
- # Try number from file after hardware info so this takes precedence for the
- # one we use later.
- activateRegNumResult = None
- registrationNumber = None
- try:
- registrationNumber = rhnreg.readRegNum()
- except IOError, error:
- log.log_me("There was an error while reading the registration "
- "number from disk:\n%s" % error)
- if registrationNumber:
- if serverType == 'hosted':
- try:
- activateRegNumResult = rhnreg.activateRegistrationNumber(
- username, password,
registrationNumber,
- organization)
- if activateRegNumResult.getStatus() == ActivationResult.ACTIVATED_NOW:
- reviewLog.autoActivatedRegistrationNumber(registrationNumber,
- activateRegNumResult)
- regNum = activateRegNumResult.getRegistrationNumber()
- rhnreg.writeRegNum(regNum)
- except up2dateErrors.NotEntitlingError:
- log.log_me("The installation number on disk is not
entitling.")
- regNum = registrationNumber
- rhnreg.writeRegNum(regNum)
- except up2dateErrors.Error, error:
- log.log_me("There was an error while activating the installation
"
- "number found on disk:\n%s" % error)
- reviewLog.foundRegNumButCouldntActivate()
- else:
- regNum = registrationNumber
-
- return (activateRegNumResult, activateHWResult)
-
def try_to_activate_hardware():
global hw_activation_code
if serverType == 'hosted':
commit 44f25e5d3e765691b684814bf4e60f94a8b28421
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:04:19 2010 +0200
activateSubscriptionShouldBeShown no longer used, removing.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index a24db99..8fd2370 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -514,52 +514,6 @@ class LoginPage:
return False
-def activateSubscriptionShouldBeShown():
- """If we activate an EN from disk and/or hardware info (eg asset tag)
and
- one of them provides an entitlement for the base channel the system needs
- OR they have at least one available entitlement of the type the system
- needs, then we skip the activation screen (return False).
-
- This is a loose function because it's difficult to use it in firstboot
- where we want to without a hack if it's in ActivateSubscriptionPage.
-
- """
- try:
- setBusyCursor()
-
- # We have to call autoActivateNumbersOnce for satellite b/c it reads
- # and stores the IN # on disk, which we need.
- registrationNumberStatus, oemNumberStatus = autoActivateNumbersOnce()
- # Go ahead and return False if we're satellite.
- if rhnreg.getServerType() == 'satellite':
- return False
-
- # We should only skip the screen based on available subs (not
- # autoactivation) if we pass through any time after the first. That's
- # implemented by autoActivateNumbersOnce returning None, None on any
- # call after the first.
- if registrationNumberStatus and \
- registrationNumberStatus.getStatus() == ActivationResult.ACTIVATED_NOW:# and
\
- # TODO up2dateUtils.getOSRelease() in
registrationNumberStatus[ActivationResult.RELEASE]:
- return False
- if oemNumberStatus and \
- oemNumberStatus.getStatus() == ActivationResult.ACTIVATED_NOW:# and \
- # TODO up2dateUtils.getOSRelease() in
oemNumberStatus[ActivationResult.RELEASE]:
- return False
- availableSubs = rhnreg.getAvailableSubscriptions(username, password)
-
- # I use != instead of > because -1 == infinite
- if int(availableSubs) != 0:
- return False
- except up2dateErrors.Error:
- setArrowCursor()
- log.log_me("There was an error while trying to figure out if we should
"
- "skip the activation screen, so we'll show it. Error
info:")
- log.log_exception(*sys.exc_info())
- setArrowCursor()
- return True
-
-
class ActivateSubscriptionPage:
"""The screen that allows activation a installation number.
commit de32378225f256d3e5d4a65aab250946895e4681
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Apr 2 11:30:00 2010 +0200
Set the global hw_activation_code properly.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index eddc100..a24db99 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -694,7 +694,6 @@ def chooseChannelShouldBeShown():
Returns True if the choose channel window should be shown, else
returns False.
'''
- global hw_activation_code
# First and foremost, we should try to activate hardware
try_to_activate_hardware()
@@ -1617,10 +1616,13 @@ def autoActivateNumbersOnce():
return (activateRegNumResult, activateHWResult)
def try_to_activate_hardware():
+ global hw_activation_code
if serverType == 'hosted':
# hardware asset codes only make sense on hosted
setBusyCursor()
- hw_activation_code = rhnreg._activate_hardware(username, password)
+ code = rhnreg._activate_hardware(username, password)
+ if code != None:
+ hw_activation_code = code
setArrowCursor()
def hasBaseChannelAndUpdates():