client/rhel/rhn-client-tools/rhn-client-tools.spec
| 19
client/rhel/rhn-client-tools/setuptool.d/Makefile
| 10
client/rhel/rhn-client-tools/src/Makefile
| 2
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/Makefile
| 41 +
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_choose_server_gui.py
| 72 +++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_create_profile_gui.py
| 79 +++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_finish_gui.py
| 77 +++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_login_gui.py
| 131 ++++++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_provide_certificate_gui.py
| 71 +++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_register_firstboot_gui_window.py
| 108 +++++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_review_gui.py
| 66 +++
client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_start_gui.py
| 105 ++++
client/rhel/rhn-client-tools/src/firstboot/Makefile
| 16
client/rhel/rhn-client-tools/src/firstboot/rhn_choose_server_gui.py
| 80 +--
client/rhel/rhn-client-tools/src/firstboot/rhn_create_profile_gui.py
| 82 +--
client/rhel/rhn-client-tools/src/firstboot/rhn_finish_gui.py
| 79 +--
client/rhel/rhn-client-tools/src/firstboot/rhn_login_gui.py
| 174 +++-----
client/rhel/rhn-client-tools/src/firstboot/rhn_provide_certificate_gui.py
| 72 +--
client/rhel/rhn-client-tools/src/firstboot/rhn_register.py
| 32 +
client/rhel/rhn-client-tools/src/firstboot/rhn_register_firstboot_gui_window.py
| 108 -----
client/rhel/rhn-client-tools/src/firstboot/rhn_review_gui.py
| 67 +--
client/rhel/rhn-client-tools/src/firstboot/rhn_start_gui.py
| 65 +--
client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
| 12
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
| 36 +
java/code/src/com/redhat/rhn/common/db/datasource/xml/ErrataCache_queries.xml
| 12
java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.hbm.xml
| 2
java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
| 106 ++---
java/code/src/com/redhat/rhn/domain/errata/CveFactory.java
| 12
java/code/src/com/redhat/rhn/frontend/action/multiorg/test/OrgSoftwareSubscriptionsActionTest.java
| 2
java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ssm/SchedulePackageUpgradeAction.java
| 17
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
| 2
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/ChannelHandler.java
| 15
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
| 3
java/code/src/com/redhat/rhn/manager/channel/ChannelProcedure.java
| 212 ++++++++++
java/code/src/com/redhat/rhn/manager/channel/ChannelSubscriptionException.java
| 58 ++
java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java
| 19
java/code/src/com/redhat/rhn/manager/org/MigrationManager.java
| 2
java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
| 6
java/code/src/com/redhat/rhn/manager/system/SystemManager.java
| 64 ---
39 files changed, 1552 insertions(+), 584 deletions(-)
New commits:
commit 7e9dea6f9bec396e4a59fe8a9cd23b41329a46bc
Merge: ec9d0a4... 628c410...
Author: Partha Aji <paji(a)redhat.com>
Date: Tue May 25 11:33:14 2010 -0400
Merge branch 'master' into flex-guest
commit 628c410dba6e60494ff6e098842f0c2e74c784fb
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue May 25 16:36:37 2010 +0200
Revert "MD5"
This reverts commit 8a49d46cf6e895b13c6d68da173b63065bc5ce9a.
People probably would not appreciate this change.
diff --git a/rel-eng/Makefile.srpm b/rel-eng/Makefile.srpm
index b77a38f..e1d16ff 100644
--- a/rel-eng/Makefile.srpm
+++ b/rel-eng/Makefile.srpm
@@ -11,8 +11,7 @@ ifdef X_RPMBUILD_DIR
X_RPMBUILD_DIR_OPTS = --define "_sourcedir $(CURDIR)" \
--define "_builddir $(X_RPMBUILD_DIR)/BUILD" \
--define "_srcrpmdir $(X_RPMBUILD_DIR)" \
- --define "_rpmdir $(X_RPMBUILD_DIR)" \
- --define "_source_filedigest_algorithm md5"
+ --define "_rpmdir $(X_RPMBUILD_DIR)"
# The COMMIT parameter is used when we want to make tar.gz / .src.rpm
# from any commit we like (including HEAD). In that case thou, the
commit 8a49d46cf6e895b13c6d68da173b63065bc5ce9a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Feb 19 14:52:19 2010 +0100
MD5
diff --git a/rel-eng/Makefile.srpm b/rel-eng/Makefile.srpm
index e1d16ff..b77a38f 100644
--- a/rel-eng/Makefile.srpm
+++ b/rel-eng/Makefile.srpm
@@ -11,7 +11,8 @@ ifdef X_RPMBUILD_DIR
X_RPMBUILD_DIR_OPTS = --define "_sourcedir $(CURDIR)" \
--define "_builddir $(X_RPMBUILD_DIR)/BUILD" \
--define "_srcrpmdir $(X_RPMBUILD_DIR)" \
- --define "_rpmdir $(X_RPMBUILD_DIR)"
+ --define "_rpmdir $(X_RPMBUILD_DIR)" \
+ --define "_source_filedigest_algorithm md5"
# The COMMIT parameter is used when we want to make tar.gz / .src.rpm
# from any commit we like (including HEAD). In that case thou, the
commit fac7c7e24691a923ca5041eb4584ed218eff22ce
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue May 25 16:01:07 2010 +0200
585188 - refactor the RHN Register firstboot code to match firstboot 1.110 on Fedora
12 and RHEL 6.
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec
b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index 4b4ee3f..bdb8750 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -116,10 +116,11 @@ rm $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/hardware_hal.*
rm $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/hardware_gudev.*
%endif
-%if 0%{?rhel} < 6
+%if 0%{?rhel} > 0 && 0%{?rhel} < 6
rm -rf $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/firstboot
+rm -f $RPM_BUILD_ROOT%{_datadir}/firstboot/modules/rhn_register.*
%else
-rm -rf $RPM_BUILD_ROOT%{_datadir}/firstboot/modules
+rm -rf $RPM_BUILD_ROOT%{_datadir}/firstboot/modules/rhn_*_*.*
%endif
desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications --vendor=rhn
rhn_register.desktop
@@ -259,7 +260,7 @@ make -f Makefile.rhn-client-tools test
%{_datadir}/icons/hicolor/48x48/apps/up2date.png
%{_datadir}/applications/rhn_register.desktop
-%if 0%{?rhel} < 6
+%if 0%{?rhel} > 0 && 0%{?rhel} < 6
%{_datadir}/firstboot/modules/rhn_login_gui.*
%{_datadir}/firstboot/modules/rhn_register_firstboot_gui_window.*
%{_datadir}/firstboot/modules/rhn_start_gui.*
@@ -269,8 +270,8 @@ make -f Makefile.rhn-client-tools test
%{_datadir}/firstboot/modules/rhn_review_gui.*
%{_datadir}/firstboot/modules/rhn_finish_gui.*
%else
+%{_datadir}/firstboot/modules/rhn_register.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_login_gui.*
-%{_datadir}/rhn/up2date_client/firstboot/rhn_register_firstboot_gui_window.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_start_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_choose_server_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_provide_certificate_gui.*
diff --git a/client/rhel/rhn-client-tools/src/firstboot/Makefile
b/client/rhel/rhn-client-tools/src/firstboot/Makefile
index 68fd1ac..7defb90 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/Makefile
+++ b/client/rhel/rhn-client-tools/src/firstboot/Makefile
@@ -2,12 +2,14 @@
#
# $Id$
+TOPMODULE = rhn_register
MODULES = rhn_login_gui \
- 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
+TOPPYFILE = $(addsuffix .py, $(TOPMODULE))
PYFILES = $(addsuffix .py, $(MODULES))
+TOPOBJECT = $(TOPPYFILE) $(addsuffix .pyc, $(TOPMODULE))
OBJECTS = $(PYFILES) $(addsuffix .pyc, $(MODULES))
# Install stuff
@@ -16,26 +18,28 @@ INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 --verbose -d
# Install Directories
+SYSTEMFIRSTBOOTDIR = $(PREFIX)/usr/share/firstboot/modules/
FIRSTBOOTDIR = $(PREFIX)/usr/share/rhn/up2date_client/firstboot/
PYCHECKER = /usr/bin/pychecker
-all:: $(OBJECTS)
+all:: $(TOPOBJECT) $(OBJECTS)
# default compile rule:
%.pyc: %.py
python -c "import py_compile; py_compile.compile('$<')"
-install: all $(FIRSTBOOTDIR)
+install: all $(FIRSTBOOTDIR) $(SYSTEMFIRSTBOOTDIR)
$(INSTALL_DATA) $(OBJECTS) $(FIRSTBOOTDIR)/
+ $(INSTALL_DATA) $(TOPOBJECT) $(SYSTEMFIRSTBOOTDIR)/
-$(FIRSTBOOTDIR) :
+$(SYSTEMFIRSTBOOTDIR) $(FIRSTBOOTDIR) :
@$(INSTALL_DIR) $@
clean:
@rm -rf *.pyc *~ .*~ *.o
pychecker::
- @$(PYCHECKER) $(PYFILES) || exit 0
+ @$(PYCHECKER) $(PYFILES) $(TOPPYFILE) || exit 0
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_choose_server_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_choose_server_gui.py
index 83f88ab..6c8743c 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_choose_server_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_choose_server_gui.py
@@ -1,4 +1,4 @@
-# Copyright 2006 Red Hat, Inc.
+# Copyright 2006--2010 Red Hat, Inc.
#
# 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
@@ -15,58 +15,62 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
# Daniel Benamy <dbenamy(a)redhat.com>
-import os
import sys
-sys.path.append("/usr/share/rhn/up2date_client/")
sys.path.append("/usr/share/rhn")
-import rhnreg
-import rhnregGui
-import up2dateErrors
-from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
+from up2date_client import up2dateErrors
import gtk
from gtk import glade
+
import gettext
-_ = gettext.gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
-gettext.textdomain("rhn-client-tools")
gtk.glade.bindtextdomain("rhn-client-tools")
+from firstboot.module import Module
+from firstboot.constants import *
-class RhnChooseServerWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.ChooseServerPage):
- runPriority=106.5
- moduleName = _("Choose Server")
- windowTitle = moduleName
- shortMessage = _("Choose a Red Hat Network server")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
-
+class moduleClass(Module):
def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.ChooseServerPage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
-
- def _getVbox(self):
- return self.chooseServerPageVbox()
-
- def updatePage(self):
- self.chooseServerPagePrepare()
-
- def apply(self, *args):
- """Returns True to change the page (to the one
set)."""
+ Module.__init__(self)
+ self.priority = 106.5
+ self.sidebarTitle = _("Choose Server")
+ self.title = _("Choose Server")
+
+ def needsNetwork(self):
+ return True
+
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
+
try:
- if self.chooseServerPageApply() is False:
- self.parent.setPage("rhn_login_gui")
- return True
+ if self.chooseServerPage.chooseServerPageApply() is False:
+ interface.moveToPage(moduleTitle=_("Red Hat Login"))
+ return RESULT_JUMP
else:
- return None
+ return RESULT_FAILURE
except up2dateErrors.SSLCertificateVerifyFailedError:
- self.parent.setPage("rhn_provide_certificate_gui")
- return True
+ interface.moveToPage(moduleTitle=_("Provide Certificate"))
+ return RESULT_JUMP
+ # return RESULT_SUCCESS should work just as well since the
+ # certificate page with priority 107 is the next one anyway
+
+ def createScreen(self):
+ self.chooseServerPage = rhnregGui.ChooseServerPage()
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self.chooseServerPage.chooseServerPageVbox(), True, True)
+ def initializeUI(self):
+ self.chooseServerPage.chooseServerPagePrepare()
+
+ def shouldAppear(self):
+ if rhnreg.registered():
+ return False
+ return True
-childWindow = RhnChooseServerWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_create_profile_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_create_profile_gui.py
index e49b520..13d974d 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_create_profile_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_create_profile_gui.py
@@ -1,6 +1,4 @@
-# rhn_register.py - GUI front end code for firstboot screen resolution
-#
-# Copyright 2003 Red Hat, Inc.
+# Copyright 2003--2010 Red Hat, Inc.
# Copyright 2003 Brent Fox <bfox(a)redhat.com>
#
# This program is free software; you can redistribute it and/or modify
@@ -17,63 +15,59 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
+# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
-import gtk
-import gobject
import sys
-import os
-import functions
+sys.path.append("/usr/share/rhn")
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
-import gnome, gnome.ui
+import gtk
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")
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
+gtk.glade.bindtextdomain("rhn-client-tools")
-class RhnCreateProfileWindow(RhnRegisterFirstbootGuiWindow,
rhnregGui.CreateProfilePage):
- #You must specify a runPriority for the order in which you wish your module to run
- runPriority = 108.7
- moduleName = _("Create Profile")
- windowTitle = moduleName
- shortMessage = _("Connect to Red Hat Network")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
+from firstboot.module import Module
+from firstboot.constants import *
+class moduleClass(Module):
def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.CreateProfilePage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
+ Module.__init__(self)
+ self.priority = 108.7
+ self.sidebarTitle = _("Create Profile")
+ self.title = _("Create Profile")
- def updatePage(self):
- self.createProfilePagePrepare()
-
- def _getVbox(self):
- return self.createProfilePageVbox()
+ def needsNetwork(self):
+ return True
- def apply(self, *args):
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
- ret = self.createProfilePageVerify()
+ ret = self.createProfilePage.createProfilePageVerify()
if ret:
- return None
+ return RESULT_FAILURE
- ret = self.createProfilePageApply()
+ ret = self.createProfilePage.createProfilePageApply()
if ret:
- return None
+ return RESULT_FAILURE
+ return RESULT_SUCCESS
+
+ def createScreen(self):
+ self.createProfilePage = rhnregGui.CreateProfilePage()
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self.createProfilePage.createProfilePageVbox(), True, True)
+
+ def initializeUI(self):
+ self.createProfilePage.createProfilePagePrepare()
+
+ def shouldAppear(self):
+ if rhnreg.registered():
+ return False
return True
-childWindow = RhnCreateProfileWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_finish_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_finish_gui.py
index fa4c6ce..54fe35b 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_finish_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_finish_gui.py
@@ -1,4 +1,4 @@
-# Copyright 2006 Red Hat, Inc.
+# Copyright 2006--2010 Red Hat, Inc.
#
# 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
@@ -15,63 +15,54 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
# Daniel Benamy <dbenamy(a)redhat.com>
import sys
-sys.path.append("/usr/share/rhn/up2date_client/")
sys.path.append("/usr/share/rhn")
-import rhnreg
-import rhnregGui
-from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
-import config
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
+from up2date_client import config
import gtk
from gtk import glade
+
import gettext
-_ = gettext.gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
-gettext.textdomain("rhn-client-tools")
gtk.glade.bindtextdomain("rhn-client-tools")
+from firstboot.module import Module
+from firstboot.constants import *
-class RhnFinishWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.FinishPage):
- runPriority=109
- moduleName = _("Finish Updates Setup")
- windowTitle = moduleName
- shortMessage = _("Connect to Red Hat Network")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
-
+class moduleClass(Module):
def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.FinishPage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
-
- def _getVbox(self):
- return self.finishPageVbox()
-
- def updatePage(self):
-## if rhnregGui.hasBaseChannelAndUpdates():
-## self.druid.finish.set_label(_("_Finish"))
-## title = _("Finish setting up software updates")
-## else:
-## self.druid.finish.set_label(_("_Exit registration process"))
-## title = _("Registration unsuccessful")
- self.finishPagePrepare()
-## self.mainWin.set_title(title)
-## self.finishPage.set_title(title)
-
- def apply(self, *args):
- """Returns None to stay on the same page. Anything else will cause
- firstboot to advance but True is generally used. This is different from
- the gnome druid in rhn_register.
-
- """
+ Module.__init__(self)
+ self.priority = 109
+ self.sidebarTitle = _("Finish Updates Setup")
+ self.title = _("Finish Updates Setup")
+
+ def needsNetwork(self):
+ return True
+
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
+
up2DateConfig = config.initUp2dateConfig()
up2DateConfig.save()
- return True
+ return RESULT_SUCCESS
+
+ def createScreen(self):
+ self.finishPage = rhnregGui.FinishPage()
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self.finishPage.finishPageVbox(), True, True)
+
+ def initializeUI(self):
+ self.finishPage.finishPagePrepare()
+ def shouldAppear(self):
+ if rhnreg.registered():
+ return False
+ return True
-childWindow = RhnFinishWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_login_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_login_gui.py
index 6fea3ab..516156e 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_login_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_login_gui.py
@@ -1,6 +1,4 @@
-# rhn_register.py - GUI front end code for firstboot screen resolution
-#
-# Copyright 2003 Red Hat, Inc.
+# Copyright 2006--2010 Red Hat, Inc.
# Copyright 2003 Brent Fox <bfox(a)redhat.com>
#
# This program is free software; you can redistribute it and/or modify
@@ -17,115 +15,97 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
+# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
-import gtk
-import gobject
import sys
-import os
-import functions
+sys.path.append("/usr/share/rhn")
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
+from up2date_client import up2dateErrors
+# from up2date_client import messageWindow
-import gnome, gnome.ui
+import gtk
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
-
-
-##
-## I18N
-##
import gettext
-_ = gettext.gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
-gettext.textdomain("rhn-client-tools")
-gtk.glade.bindtextdomain("rhn-client-tools", "/usr/share/locale")
+gtk.glade.bindtextdomain("rhn-client-tools")
+from firstboot.module import Module
+from firstboot.constants import *
+class moduleClass(Module):
+ def __init__(self):
+ Module.__init__(self)
+ self.priority = 108.5
+ self.sidebarTitle = _("Red Hat Login")
+ self.title = _("Red Hat Login")
-class RhnLoginWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.LoginPage):
- #You must specify a runPriority for the order in which you wish your module to run
- runPriority = 108
- moduleName = _("Red Hat Login")
- windowTitle = moduleName
- shortMessage = _("Register with Red Hat Network")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
+ def needsNetwork(self):
+ return True
- def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.LoginPage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
-
- def updatePage(self):
-# self.getCaps()
- self.loginPagePrepare()
- self.goingNextFromNewAccountDialog = False
-
- def grabFocus(self):
- # We must set focus where we want it here. Setting it in updatePage
- # doesn't work.
- self.loginXml.get_widget("loginUserEntry").grab_focus()
-
- def _getVbox(self):
- return self.loginPageVbox()
-
- def apply(self, *args):
- """Returns None to stay on the same page. Anything else will cause
- firstboot to advance but True is generally used. This is different from
- the gnome druid in rhn_register.
-
- """
- if self.doDebug:
- print "applying rhn_login_gui"
-
- # This is a hack. This function will get called if they click next on
- # the login page (the else) or when they create an account (the if). In
- # that case we don't want to do the normal logging in stuff.
- if self.goingNextFromNewAccountDialog:
- assert rhnregGui.newAccount is True
- else:
- if self.loginPageVerify():
- return None
-
- assert rhnregGui.newAccount is False
-
- try:
- ret = self.loginPageApply()
- # TODO this exception can't reach here right now. ditch it and/or
- # figure out how we want to provide this functionality.
- except up2dateErrors.CommunicationError, e:
- msg = _("There was a communication error with the server: %s" %
e.errmsg)
- msg = msg + "\n\n" + _("Would you like to try changing the
network configuration and trying again?")
- dlg = messageWindow.YesNoDialog(msg)
- ret = dlg.getrc()
- if ret:
- return None
- else:
- self.parent.setPage("rhn_finish_gui")
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
+
+ if self.loginPage.loginPageVerify():
+ return RESULT_FAILURE
+
+ try:
+ ret = self.loginPage.loginPageApply()
+ # TODO this exception can't reach here right now. ditch it and/or
+ # figure out how we want to provide this functionality.
+ except up2dateErrors.CommunicationError, e:
+ msg = _("There was a communication error with the server: %s" %
e.errmsg)
+ msg = msg + "\n\n" + _("Would you like to try changing the
network configuration and trying again?")
+ dlg = messageWindow.YesNoDialog(msg)
+ ret = dlg.getrc()
if ret:
- return None
+ return RESULT_FAILURE
+ else:
+ interface.moveToPage(moduleTitle=_("Finish Updates Setup"))
+ return RESULT_JUMP
+
+ if ret:
+ return RESULT_FAILURE
# We should try to activate hardware, even if no EUS in firstboot
rhnregGui.try_to_activate_hardware()
- self.parent.setPage('rhn_create_profile_gui')
+ return RESULT_SUCCESS
+
+ def createScreen(self):
+ self.loginPage = FirstbootLoginPage()
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self.loginPage.loginPageVbox(), True, True)
+
+ def initializeUI(self):
+ self.loginPage.loginPagePrepare()
+
+ def shouldAppear(self):
+ if rhnreg.registered():
+ return False
return True
-
+
+ def focus(self):
+ self.loginPage.loginXml.get_widget("loginUserEntry").grab_focus()
+
+class FirstbootLoginPage(rhnregGui.LoginPage):
+ def __init__(self):
+ rhnregGui.LoginPage.__init__(self)
+
def goToPageAfterLogin(self):
- # This is a hack. More info above.
- self.goingNextFromNewAccountDialog = True
- self.parent.nextClicked()
-
- def onLoginPageNext(self, dummy=None, dummy2=None):
- # This is a hackish way to support enter advancing
- self.parent.nextClicked()
-
-childWindow = RhnLoginWindow
+ pass
+
+# FIXME: the Enter advancing is not working.
+#
+# def goToPageAfterLogin(self):
+# # This is a hack. More info above.
+# self.goingNextFromNewAccountDialog = True
+# self.parent.nextClicked()
+#
+# def onLoginPageNext(self, dummy=None, dummy2=None):
+# # This is a hackish way to support enter advancing
+# self.parent.nextClicked()
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_provide_certificate_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_provide_certificate_gui.py
index 319d29a..68aeebc 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_provide_certificate_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_provide_certificate_gui.py
@@ -1,4 +1,4 @@
-# Copyright 2006 Red Hat, Inc.
+# Copyright 2006--2010 Red Hat, Inc.
#
# 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
@@ -15,57 +15,61 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
# Daniel Benamy <dbenamy(a)redhat.com>
-import os
import sys
-sys.path.append("/usr/share/rhn/up2date_client/")
sys.path.append("/usr/share/rhn")
-import rhnreg
-import rhnregGui
-import up2dateErrors
-from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
import gtk
from gtk import glade
+
import gettext
-_ = gettext.gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
-gettext.textdomain("rhn-client-tools")
gtk.glade.bindtextdomain("rhn-client-tools")
+from firstboot.module import Module
+from firstboot.constants import *
-class RhnProvideCertificateWindow(RhnRegisterFirstbootGuiWindow,
rhnregGui.ProvideCertificatePage):
- runPriority=107
- moduleName = _("Provide Certificate")
- windowTitle = moduleName
- shortMessage = _("Provide a certificate for this Red Hat Network server")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
-
+class moduleClass(Module):
def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.ProvideCertificatePage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
-
- def _getVbox(self):
- return self.provideCertificatePageVbox()
-
- def apply(self, *args):
- """Returns True to change the page or None to stay on the same
page."""
- status = self.provideCertificatePageApply()
+ Module.__init__(self)
+ self.priority = 107.5
+ self.sidebarTitle = _("Provide Certificate")
+ self.title = _("Provide Certificate")
+
+ def needsNetwork(self):
+ return True
+
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
+
+ status = self.provideCertificatePage.provideCertificatePageApply()
if status == 0: # cert was installed
- return True
+ return RESULT_SUCCESS
elif status == 1: # the user doesn't want to provide a cert right now
# TODO write a message to disk like the other cases? need to decide
# how we want to do error handling in general.
- self.parent.setPage("rhn_finish_gui")
- return True
+ interface.moveToPage(moduleTitle=_("Finish Updates Setup"))
+ return RESULT_JUMP
else: # an error occurred and the user was notified
assert status == 2
- return None
+ return RESULT_FAILURE
+
+ def createScreen(self):
+ self.provideCertificatePage = rhnregGui.ProvideCertificatePage()
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self.provideCertificatePage.provideCertificatePageVbox(),
True, True)
+ def initializeUI(self):
+ self.provideCertificatePage.setUrlInWidget()
+
+ def shouldAppear(self):
+ if rhnreg.registered():
+ return False
+ return True
-childWindow = RhnProvideCertificateWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_register.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_register.py
new file mode 100644
index 0000000..c07329f
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_register.py
@@ -0,0 +1,32 @@
+# Copyright 2010 Red Hat, Inc.
+#
+# 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.
+#
+# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
+
+from firstboot.moduleset import *
+
+import gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
+
+class moduleClass(ModuleSet):
+ def __init__(self):
+ ModuleSet.__init__(self)
+ self.priority = 2
+ self.sidebarTitle = _("Set Up Software Updates")
+ self.title = _("Set Up Software Updates")
+ self.path = "/usr/share/rhn/up2date_client/firstboot"
+
diff --git
a/client/rhel/rhn-client-tools/src/firstboot/rhn_register_firstboot_gui_window.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_register_firstboot_gui_window.py
deleted file mode 100644
index 60725ac..0000000
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_register_firstboot_gui_window.py
+++ /dev/null
@@ -1,108 +0,0 @@
-import functions # firstboot stuff
-import os
-import sys
-import gtk
-
-from firstboot_module_window import FirstbootModuleWindow
-
-sys.path.append("/usr/share/rhn/up2date_client/")
-sys.path.append("/usr/share/rhn")
-import messageWindow
-import rhnregGui
-
-class RhnRegisterFirstbootGuiWindow(FirstbootModuleWindow):
- """This is a base class for our firstboot screens. It shouldn't be
used
- directly.
-
- """
- needsparent = 1
-
- def __init__(self):
- FirstbootModuleWindow.__init__(self)
- self.doDebug = False
- # Variables that fb windows need to define
- assert hasattr(self, 'runPriority')
- assert hasattr(self, 'moduleName')
- assert hasattr(self, 'windowTitle')
- assert hasattr(self, 'shortMessage')
- assert hasattr(self, 'needsparent')
- # Method to provide the screen contents
- assert hasattr(self, '_getVbox')
-
- def passInParent(self,parent):
- self.parent = parent
-
- def getNext(self):
- pass
-
- def launch(self, doDebug=None):
- """Firstboot calls this to set up the screen. It will use the
_getVbox
- method provided by the derived classes to get the contents of the
- screen.
-
- """
- self.doDebug = doDebug
- if self.doDebug:
- print self.__class__.__name__, "launch called."
-
- self.icon =
functions.imageFromPath("/usr/share/system-config-display/pixmaps/system-config-display.png")
- self.mainVBox = gtk.VBox()
-
- internalVBox = gtk.VBox(False, 10)
- internalVBox.set_border_width(10)
-
- vbox = self._getVbox()
-
- internalVBox.pack_start(vbox, True)
- self.mainVBox.pack_start(internalVBox, True)
-
- # Set up cursor changing functions. Overriding functions that aren't in
- # classes like this could be called a hack, but I think it's the best
- # we can do with the current overall setup and isn't too bad.
- # Having it here will cause this to get called once per module, but I'm
- # not sure if it'll work to put it in the constructor.
- def mySetBusyCursor():
- cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
- # I think we have to set the cursor using firstboot's .window instead of
- # the one in our vboxes because the thing we use must be displayed when
- # we change the cursor and sometimes this gets called by a screen before
- # it's visible.
- # TODO See if we can add functions to firstboot to provide a nice way to
- # change the cursor.
- self.parent.win.window.set_cursor(cursor)
- while gtk.events_pending():
- gtk.main_iteration(False)
- def mySetArrowCursor():
- # I think we have to set the cursor using firstboot's .window instead of
- # the one in our vboxes because the thing we use must be displayed when
- # we change the cursor and sometimes this gets called by a screen before
- # it's visible.
- self.parent.win.window.set_cursor(None)
- while gtk.events_pending():
- gtk.main_iteration(False)
- rhnregGui.setBusyCursor = mySetBusyCursor
- rhnregGui.setArrowCursor = mySetArrowCursor
-
- return self.mainVBox, self.icon, self.windowTitle
-
- def grabFocus(self):
- if self.doDebug:
- print self.__class__.__name__, "grabFocus called."
- pass
-
- def fatalError(self, error, wrap=1):
- # FIXME
- if wrap:
- text = messageWindow.wrap_text(error)
- else:
- text = error
- dlg = messageWindow.ErrorDialog(text)
- self._goImmediatelyToFinish()
-
- def _goImmediatelyToFinish(self):
- self.parent.setPage("rhn_finish_gui")
- def dummyApply(self, *args):
- print "dummy"
- return True
- self.apply = dummyApply
- self.parent.nextClicked()
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_review_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_review_gui.py
index 982a67f..eb12ae2 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_review_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_review_gui.py
@@ -1,4 +1,4 @@
-# Copyright 2006 Red Hat, Inc.
+# Copyright 2006--2010 Red Hat, Inc.
#
# 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
@@ -15,52 +15,51 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
# Daniel Benamy <dbenamy(a)redhat.com>
import sys
-sys.path.append("/usr/share/rhn/up2date_client/")
sys.path.append("/usr/share/rhn")
-import rhnreg
-import rhnregGui
-from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
import gtk
from gtk import glade
+
import gettext
-_ = gettext.gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
-gettext.textdomain("rhn-client-tools")
gtk.glade.bindtextdomain("rhn-client-tools")
+from firstboot.module import Module
+from firstboot.constants import *
-class RhnReviewWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.ReviewSubscriptionPage):
- runPriority=108.9
- moduleName = _("Review Subscription")
- windowTitle = moduleName
- shortMessage = _("Connect to Red Hat Network")
- needsparent = 1
- needsnetwork = 1
- noSidebar = True
-
+class moduleClass(Module):
def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- rhnregGui.ReviewSubscriptionPage.__init__(self)
- if rhnreg.registered():
- self.skipme = True
-
- def _getVbox(self):
- return self.reviewSubscriptionPageVbox()
-
- def updatePage(self):
- self.reviewSubscriptionPagePrepare()
-
- def apply(self, *args):
- """Returns None to stay on the same page. Anything else will cause
- firstboot to advance but True is generally used. This is different from
- the gnome druid in rhn_register.
-
- """
+ Module.__init__(self)
+ self.priority = 108.9
+ self.sidebarTitle = _("Review Subscription")
+ self.title = _("Review Subscription")
+
+ def needsNetwork(self):
return True
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
+
+ return RESULT_SUCCESS
+
+ def createScreen(self):
+ self.reviewSubscriptionPage = rhnregGui.ReviewSubscriptionPage()
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self.reviewSubscriptionPage.reviewSubscriptionPageVbox(),
True, True)
+
+ def initializeUI(self):
+ self.reviewSubscriptionPage.reviewSubscriptionPagePrepare()
+
+ def shouldAppear(self):
+ if rhnreg.registered():
+ return False
+ return True
-childWindow = RhnReviewWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot/rhn_start_gui.py
b/client/rhel/rhn-client-tools/src/firstboot/rhn_start_gui.py
index 0a587c2..2346b20 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/rhn_start_gui.py
+++ b/client/rhel/rhn-client-tools/src/firstboot/rhn_start_gui.py
@@ -1,4 +1,4 @@
-# Copyright 2006 Red Hat, Inc.
+# Copyright 2006--2010 Red Hat, Inc.
#
# 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
@@ -15,56 +15,64 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
+# Jan Pazdziora jpazdziora at redhat dot com
# Daniel Benamy <dbenamy(a)redhat.com>
-import os
import sys
-sys.path.append("/usr/share/rhn/up2date_client/")
sys.path.append("/usr/share/rhn")
-import rhnreg
-import rhnregGui
-from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+from up2date_client import rhnreg
+from up2date_client import rhnregGui
import gtk
from gtk import glade
+
import gettext
-_ = gettext.gettext
+_ = lambda x: gettext.ldgettext("rhn-client-tools", x)
-gettext.textdomain("rhn-client-tools")
gtk.glade.bindtextdomain("rhn-client-tools")
+from firstboot.module import Module
+from firstboot.constants import *
-class RhnStartWindow(RhnRegisterFirstbootGuiWindow):
- runPriority=106
- moduleName = _("Set Up Software Updates")
- windowTitle = moduleName
- shortMessage = _("Register with Red Hat Network")
- needsparent = 1
-
+from firstboot.loader import _haveNetwork
+
+class moduleClass(Module):
def __init__(self):
- RhnRegisterFirstbootGuiWindow.__init__(self)
- self.start_page = None
+ Module.__init__(self)
+ self.priority = 106
+ self.sidebarTitle = _("Set Up Software Updates")
+ self.title = _("Set Up Software Updates")
+
+ def apply(self, interface, testing=False):
+ if testing:
+ return RESULT_SUCCESS
+
+ if not self.start_page.startPageRegisterNow():
+ dlg = rhnregGui.ConfirmQuitDialog()
+ if dlg.rc == 0:
+ return RESULT_FAILURE
+ else:
+ interface.moveToPage(moduleTitle=_("Finish Updates Setup"))
+ return RESULT_JUMP
+ return RESULT_SUCCESS
+
+ def createScreen(self):
+ self.vbox = gtk.VBox(spacing=5)
+ self.vbox.pack_start(self._getVbox(), True, True)
+
+ def initializeUI(self):
+ pass
def _getVbox(self):
if rhnreg.registered():
self.start_page = KsRegisteredPage()
return self.start_page.startPageVbox()
- if self.parent.checkNetwork():
+ if _haveNetwork():
self.start_page = rhnregGui.StartPage(firstboot=True)
else:
self.start_page = NoNetworkPage()
return self.start_page.startPageVbox()
- def apply(self, *args):
- """Returns True to change the page (to the one
set)."""
- if not self.start_page.startPageRegisterNow():
- dlg = rhnregGui.ConfirmQuitDialog()
- if not dlg.rc:
- self.parent.setPage("rhn_start_gui")
- else:
- self.parent.setPage("rhn_finish_gui")
- return True
-
class KsRegisteredPage:
def __init__(self):
@@ -102,4 +110,3 @@ class NoNetworkPage:
def why_register_button_clicked(self, button):
rhnregGui.WhyRegisterDialog()
-childWindow = RhnStartWindow
commit 945391d1501aa5987cc4dff365533f665795ba2a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue May 25 15:36:50 2010 +0200
585188 - only install legacy firstboot on RHEL 5 (and earlier), the new firstboot for
other systems.
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec
b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index 25c8dc0..4b4ee3f 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -116,6 +116,12 @@ rm $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/hardware_hal.*
rm $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/hardware_gudev.*
%endif
+%if 0%{?rhel} < 6
+rm -rf $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/firstboot
+%else
+rm -rf $RPM_BUILD_ROOT%{_datadir}/firstboot/modules
+%endif
+
desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications --vendor=rhn
rhn_register.desktop
%if 0%{?suse_version}
%suse_update_desktop_file rhn_register System
@@ -252,6 +258,8 @@ make -f Makefile.rhn-client-tools test
%{_datadir}/icons/hicolor/32x32/apps/up2date.png
%{_datadir}/icons/hicolor/48x48/apps/up2date.png
%{_datadir}/applications/rhn_register.desktop
+
+%if 0%{?rhel} < 6
%{_datadir}/firstboot/modules/rhn_login_gui.*
%{_datadir}/firstboot/modules/rhn_register_firstboot_gui_window.*
%{_datadir}/firstboot/modules/rhn_start_gui.*
@@ -260,6 +268,16 @@ make -f Makefile.rhn-client-tools test
%{_datadir}/firstboot/modules/rhn_create_profile_gui.*
%{_datadir}/firstboot/modules/rhn_review_gui.*
%{_datadir}/firstboot/modules/rhn_finish_gui.*
+%else
+%{_datadir}/rhn/up2date_client/firstboot/rhn_login_gui.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_register_firstboot_gui_window.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_start_gui.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_choose_server_gui.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_provide_certificate_gui.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_create_profile_gui.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_review_gui.*
+%{_datadir}/rhn/up2date_client/firstboot/rhn_finish_gui.*
+%endif
%changelog
* Wed May 05 2010 Jan Pazdziora 1.1.3-1
commit 07068b19b2704250d19370fa9ff8edafae358ce1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue May 25 14:28:20 2010 +0200
585188 - the firstboot modules for RHEL 5 shall retire in firstboot-legacy-rhel5.
The current firstboot modules are not compatible with latest Fedoras and
future RHEL 6. However, to still have a way to build firstboot for RHEL 5,
we will hold those modules in separate directory until they are no longer
needed.
diff --git a/client/rhel/rhn-client-tools/src/Makefile
b/client/rhel/rhn-client-tools/src/Makefile
index 62ea30c..90faa0c 100644
--- a/client/rhel/rhn-client-tools/src/Makefile
+++ b/client/rhel/rhn-client-tools/src/Makefile
@@ -6,7 +6,7 @@ PREFIX ?=
VERSION ?=
# Dirs we need to walk into
-SUBDIRS = up2date_client actions firstboot bin
+SUBDIRS = up2date_client actions firstboot firstboot-legacy-rhel5 bin
# For subdirs, required exports
export PREFIX
diff --git a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/Makefile
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/Makefile
new file mode 100644
index 0000000..bbd6365
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/Makefile
@@ -0,0 +1,41 @@
+# Makefile for installing man pages for the up2date client
+#
+# $Id$
+
+MODULES = rhn_login_gui \
+ 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
+PYFILES = $(addsuffix .py, $(MODULES))
+OBJECTS = $(PYFILES) $(addsuffix .pyc, $(MODULES))
+
+# Install stuff
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_DIR = $(INSTALL) -m 755 --verbose -d
+
+# Install Directories
+FIRSTBOOTDIR = $(PREFIX)/usr/share/firstboot/modules/
+
+
+PYCHECKER = /usr/bin/pychecker
+
+all:: $(OBJECTS)
+
+# default compile rule:
+%.pyc: %.py
+ python -c "import py_compile; py_compile.compile('$<')"
+
+install: all $(FIRSTBOOTDIR)
+ $(INSTALL_DATA) $(OBJECTS) $(FIRSTBOOTDIR)/
+
+$(FIRSTBOOTDIR) :
+ @$(INSTALL_DIR) $@
+
+clean:
+ @rm -rf *.pyc *~ .*~ *.o
+
+pychecker::
+ @$(PYCHECKER) $(PYFILES) || exit 0
+
diff --git
a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_choose_server_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_choose_server_gui.py
new file mode 100644
index 0000000..83f88ab
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_choose_server_gui.py
@@ -0,0 +1,72 @@
+# Copyright 2006 Red Hat, Inc.
+#
+# 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.
+#
+# Authors:
+# Daniel Benamy <dbenamy(a)redhat.com>
+
+import os
+import sys
+sys.path.append("/usr/share/rhn/up2date_client/")
+sys.path.append("/usr/share/rhn")
+import rhnreg
+import rhnregGui
+import up2dateErrors
+from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+
+import gtk
+from gtk import glade
+import gettext
+_ = gettext.gettext
+
+gettext.textdomain("rhn-client-tools")
+gtk.glade.bindtextdomain("rhn-client-tools")
+
+
+class RhnChooseServerWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.ChooseServerPage):
+ runPriority=106.5
+ moduleName = _("Choose Server")
+ windowTitle = moduleName
+ shortMessage = _("Choose a Red Hat Network server")
+ needsparent = 1
+ needsnetwork = 1
+ noSidebar = True
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ rhnregGui.ChooseServerPage.__init__(self)
+ if rhnreg.registered():
+ self.skipme = True
+
+ def _getVbox(self):
+ return self.chooseServerPageVbox()
+
+ def updatePage(self):
+ self.chooseServerPagePrepare()
+
+ def apply(self, *args):
+ """Returns True to change the page (to the one
set)."""
+ try:
+ if self.chooseServerPageApply() is False:
+ self.parent.setPage("rhn_login_gui")
+ return True
+ else:
+ return None
+ except up2dateErrors.SSLCertificateVerifyFailedError:
+ self.parent.setPage("rhn_provide_certificate_gui")
+ return True
+
+
+childWindow = RhnChooseServerWindow
diff --git
a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_create_profile_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_create_profile_gui.py
new file mode 100644
index 0000000..e49b520
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_create_profile_gui.py
@@ -0,0 +1,79 @@
+# 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 RhnCreateProfileWindow(RhnRegisterFirstbootGuiWindow,
rhnregGui.CreateProfilePage):
+ #You must specify a runPriority for the order in which you wish your module to run
+ runPriority = 108.7
+ moduleName = _("Create Profile")
+ windowTitle = moduleName
+ shortMessage = _("Connect to Red Hat Network")
+ needsparent = 1
+ needsnetwork = 1
+ noSidebar = True
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ rhnregGui.CreateProfilePage.__init__(self)
+ if rhnreg.registered():
+ self.skipme = True
+
+ def updatePage(self):
+ self.createProfilePagePrepare()
+
+ def _getVbox(self):
+ return self.createProfilePageVbox()
+
+ def apply(self, *args):
+
+ ret = self.createProfilePageVerify()
+ if ret:
+ return None
+
+ ret = self.createProfilePageApply()
+ if ret:
+ return None
+
+ return True
+
+childWindow = RhnCreateProfileWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_finish_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_finish_gui.py
new file mode 100644
index 0000000..fa4c6ce
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_finish_gui.py
@@ -0,0 +1,77 @@
+# Copyright 2006 Red Hat, Inc.
+#
+# 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.
+#
+# Authors:
+# Daniel Benamy <dbenamy(a)redhat.com>
+
+import sys
+sys.path.append("/usr/share/rhn/up2date_client/")
+sys.path.append("/usr/share/rhn")
+import rhnreg
+import rhnregGui
+from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+import config
+
+import gtk
+from gtk import glade
+import gettext
+_ = gettext.gettext
+
+gettext.textdomain("rhn-client-tools")
+gtk.glade.bindtextdomain("rhn-client-tools")
+
+
+class RhnFinishWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.FinishPage):
+ runPriority=109
+ moduleName = _("Finish Updates Setup")
+ windowTitle = moduleName
+ shortMessage = _("Connect to Red Hat Network")
+ needsparent = 1
+ needsnetwork = 1
+ noSidebar = True
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ rhnregGui.FinishPage.__init__(self)
+ if rhnreg.registered():
+ self.skipme = True
+
+ def _getVbox(self):
+ return self.finishPageVbox()
+
+ def updatePage(self):
+## if rhnregGui.hasBaseChannelAndUpdates():
+## self.druid.finish.set_label(_("_Finish"))
+## title = _("Finish setting up software updates")
+## else:
+## self.druid.finish.set_label(_("_Exit registration process"))
+## title = _("Registration unsuccessful")
+ self.finishPagePrepare()
+## self.mainWin.set_title(title)
+## self.finishPage.set_title(title)
+
+ def apply(self, *args):
+ """Returns None to stay on the same page. Anything else will cause
+ firstboot to advance but True is generally used. This is different from
+ the gnome druid in rhn_register.
+
+ """
+ up2DateConfig = config.initUp2dateConfig()
+ up2DateConfig.save()
+ return True
+
+
+childWindow = RhnFinishWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_login_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_login_gui.py
new file mode 100644
index 0000000..6fea3ab
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_login_gui.py
@@ -0,0 +1,131 @@
+# 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
+
+
+##
+## I18N
+##
+import gettext
+_ = gettext.gettext
+
+gettext.textdomain("rhn-client-tools")
+gtk.glade.bindtextdomain("rhn-client-tools", "/usr/share/locale")
+
+
+
+class RhnLoginWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.LoginPage):
+ #You must specify a runPriority for the order in which you wish your module to run
+ runPriority = 108
+ moduleName = _("Red Hat Login")
+ windowTitle = moduleName
+ shortMessage = _("Register with Red Hat Network")
+ needsparent = 1
+ needsnetwork = 1
+ noSidebar = True
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ rhnregGui.LoginPage.__init__(self)
+ if rhnreg.registered():
+ self.skipme = True
+
+ def updatePage(self):
+# self.getCaps()
+ self.loginPagePrepare()
+ self.goingNextFromNewAccountDialog = False
+
+ def grabFocus(self):
+ # We must set focus where we want it here. Setting it in updatePage
+ # doesn't work.
+ self.loginXml.get_widget("loginUserEntry").grab_focus()
+
+ def _getVbox(self):
+ return self.loginPageVbox()
+
+ def apply(self, *args):
+ """Returns None to stay on the same page. Anything else will cause
+ firstboot to advance but True is generally used. This is different from
+ the gnome druid in rhn_register.
+
+ """
+ if self.doDebug:
+ print "applying rhn_login_gui"
+
+ # This is a hack. This function will get called if they click next on
+ # the login page (the else) or when they create an account (the if). In
+ # that case we don't want to do the normal logging in stuff.
+ if self.goingNextFromNewAccountDialog:
+ assert rhnregGui.newAccount is True
+ else:
+ if self.loginPageVerify():
+ return None
+
+ assert rhnregGui.newAccount is False
+
+ try:
+ ret = self.loginPageApply()
+ # TODO this exception can't reach here right now. ditch it and/or
+ # figure out how we want to provide this functionality.
+ except up2dateErrors.CommunicationError, e:
+ msg = _("There was a communication error with the server: %s" %
e.errmsg)
+ msg = msg + "\n\n" + _("Would you like to try changing the
network configuration and trying again?")
+ dlg = messageWindow.YesNoDialog(msg)
+ ret = dlg.getrc()
+ if ret:
+ return None
+ else:
+ self.parent.setPage("rhn_finish_gui")
+ if ret:
+ return None
+
+ # We should try to activate hardware, even if no EUS in firstboot
+ rhnregGui.try_to_activate_hardware()
+
+ self.parent.setPage('rhn_create_profile_gui')
+ return True
+
+ def goToPageAfterLogin(self):
+ # This is a hack. More info above.
+ self.goingNextFromNewAccountDialog = True
+ self.parent.nextClicked()
+
+ def onLoginPageNext(self, dummy=None, dummy2=None):
+ # This is a hackish way to support enter advancing
+ self.parent.nextClicked()
+
+childWindow = RhnLoginWindow
diff --git
a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_provide_certificate_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_provide_certificate_gui.py
new file mode 100644
index 0000000..319d29a
--- /dev/null
+++
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_provide_certificate_gui.py
@@ -0,0 +1,71 @@
+# Copyright 2006 Red Hat, Inc.
+#
+# 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.
+#
+# Authors:
+# Daniel Benamy <dbenamy(a)redhat.com>
+
+import os
+import sys
+sys.path.append("/usr/share/rhn/up2date_client/")
+sys.path.append("/usr/share/rhn")
+import rhnreg
+import rhnregGui
+import up2dateErrors
+from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+
+import gtk
+from gtk import glade
+import gettext
+_ = gettext.gettext
+
+gettext.textdomain("rhn-client-tools")
+gtk.glade.bindtextdomain("rhn-client-tools")
+
+
+class RhnProvideCertificateWindow(RhnRegisterFirstbootGuiWindow,
rhnregGui.ProvideCertificatePage):
+ runPriority=107
+ moduleName = _("Provide Certificate")
+ windowTitle = moduleName
+ shortMessage = _("Provide a certificate for this Red Hat Network server")
+ needsparent = 1
+ needsnetwork = 1
+ noSidebar = True
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ rhnregGui.ProvideCertificatePage.__init__(self)
+ if rhnreg.registered():
+ self.skipme = True
+
+ def _getVbox(self):
+ return self.provideCertificatePageVbox()
+
+ def apply(self, *args):
+ """Returns True to change the page or None to stay on the same
page."""
+ status = self.provideCertificatePageApply()
+ if status == 0: # cert was installed
+ return True
+ elif status == 1: # the user doesn't want to provide a cert right now
+ # TODO write a message to disk like the other cases? need to decide
+ # how we want to do error handling in general.
+ self.parent.setPage("rhn_finish_gui")
+ return True
+ else: # an error occurred and the user was notified
+ assert status == 2
+ return None
+
+
+childWindow = RhnProvideCertificateWindow
diff --git
a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_register_firstboot_gui_window.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_register_firstboot_gui_window.py
new file mode 100644
index 0000000..60725ac
--- /dev/null
+++
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_register_firstboot_gui_window.py
@@ -0,0 +1,108 @@
+import functions # firstboot stuff
+import os
+import sys
+import gtk
+
+from firstboot_module_window import FirstbootModuleWindow
+
+sys.path.append("/usr/share/rhn/up2date_client/")
+sys.path.append("/usr/share/rhn")
+import messageWindow
+import rhnregGui
+
+class RhnRegisterFirstbootGuiWindow(FirstbootModuleWindow):
+ """This is a base class for our firstboot screens. It shouldn't be
used
+ directly.
+
+ """
+ needsparent = 1
+
+ def __init__(self):
+ FirstbootModuleWindow.__init__(self)
+ self.doDebug = False
+ # Variables that fb windows need to define
+ assert hasattr(self, 'runPriority')
+ assert hasattr(self, 'moduleName')
+ assert hasattr(self, 'windowTitle')
+ assert hasattr(self, 'shortMessage')
+ assert hasattr(self, 'needsparent')
+ # Method to provide the screen contents
+ assert hasattr(self, '_getVbox')
+
+ def passInParent(self,parent):
+ self.parent = parent
+
+ def getNext(self):
+ pass
+
+ def launch(self, doDebug=None):
+ """Firstboot calls this to set up the screen. It will use the
_getVbox
+ method provided by the derived classes to get the contents of the
+ screen.
+
+ """
+ self.doDebug = doDebug
+ if self.doDebug:
+ print self.__class__.__name__, "launch called."
+
+ self.icon =
functions.imageFromPath("/usr/share/system-config-display/pixmaps/system-config-display.png")
+ self.mainVBox = gtk.VBox()
+
+ internalVBox = gtk.VBox(False, 10)
+ internalVBox.set_border_width(10)
+
+ vbox = self._getVbox()
+
+ internalVBox.pack_start(vbox, True)
+ self.mainVBox.pack_start(internalVBox, True)
+
+ # Set up cursor changing functions. Overriding functions that aren't in
+ # classes like this could be called a hack, but I think it's the best
+ # we can do with the current overall setup and isn't too bad.
+ # Having it here will cause this to get called once per module, but I'm
+ # not sure if it'll work to put it in the constructor.
+ def mySetBusyCursor():
+ cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
+ # I think we have to set the cursor using firstboot's .window instead of
+ # the one in our vboxes because the thing we use must be displayed when
+ # we change the cursor and sometimes this gets called by a screen before
+ # it's visible.
+ # TODO See if we can add functions to firstboot to provide a nice way to
+ # change the cursor.
+ self.parent.win.window.set_cursor(cursor)
+ while gtk.events_pending():
+ gtk.main_iteration(False)
+ def mySetArrowCursor():
+ # I think we have to set the cursor using firstboot's .window instead of
+ # the one in our vboxes because the thing we use must be displayed when
+ # we change the cursor and sometimes this gets called by a screen before
+ # it's visible.
+ self.parent.win.window.set_cursor(None)
+ while gtk.events_pending():
+ gtk.main_iteration(False)
+ rhnregGui.setBusyCursor = mySetBusyCursor
+ rhnregGui.setArrowCursor = mySetArrowCursor
+
+ return self.mainVBox, self.icon, self.windowTitle
+
+ def grabFocus(self):
+ if self.doDebug:
+ print self.__class__.__name__, "grabFocus called."
+ pass
+
+ def fatalError(self, error, wrap=1):
+ # FIXME
+ if wrap:
+ text = messageWindow.wrap_text(error)
+ else:
+ text = error
+ dlg = messageWindow.ErrorDialog(text)
+ self._goImmediatelyToFinish()
+
+ def _goImmediatelyToFinish(self):
+ self.parent.setPage("rhn_finish_gui")
+ def dummyApply(self, *args):
+ print "dummy"
+ return True
+ self.apply = dummyApply
+ self.parent.nextClicked()
diff --git a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_review_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_review_gui.py
new file mode 100644
index 0000000..982a67f
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_review_gui.py
@@ -0,0 +1,66 @@
+# Copyright 2006 Red Hat, Inc.
+#
+# 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.
+#
+# Authors:
+# Daniel Benamy <dbenamy(a)redhat.com>
+
+import sys
+sys.path.append("/usr/share/rhn/up2date_client/")
+sys.path.append("/usr/share/rhn")
+import rhnreg
+import rhnregGui
+from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+
+import gtk
+from gtk import glade
+import gettext
+_ = gettext.gettext
+
+gettext.textdomain("rhn-client-tools")
+gtk.glade.bindtextdomain("rhn-client-tools")
+
+
+class RhnReviewWindow(RhnRegisterFirstbootGuiWindow, rhnregGui.ReviewSubscriptionPage):
+ runPriority=108.9
+ moduleName = _("Review Subscription")
+ windowTitle = moduleName
+ shortMessage = _("Connect to Red Hat Network")
+ needsparent = 1
+ needsnetwork = 1
+ noSidebar = True
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ rhnregGui.ReviewSubscriptionPage.__init__(self)
+ if rhnreg.registered():
+ self.skipme = True
+
+ def _getVbox(self):
+ return self.reviewSubscriptionPageVbox()
+
+ def updatePage(self):
+ self.reviewSubscriptionPagePrepare()
+
+ def apply(self, *args):
+ """Returns None to stay on the same page. Anything else will cause
+ firstboot to advance but True is generally used. This is different from
+ the gnome druid in rhn_register.
+
+ """
+ return True
+
+
+childWindow = RhnReviewWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_start_gui.py
b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_start_gui.py
new file mode 100644
index 0000000..0a587c2
--- /dev/null
+++ b/client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_start_gui.py
@@ -0,0 +1,105 @@
+# Copyright 2006 Red Hat, Inc.
+#
+# 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.
+#
+# Authors:
+# Daniel Benamy <dbenamy(a)redhat.com>
+
+import os
+import sys
+sys.path.append("/usr/share/rhn/up2date_client/")
+sys.path.append("/usr/share/rhn")
+import rhnreg
+import rhnregGui
+from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow
+
+import gtk
+from gtk import glade
+import gettext
+_ = gettext.gettext
+
+gettext.textdomain("rhn-client-tools")
+gtk.glade.bindtextdomain("rhn-client-tools")
+
+
+class RhnStartWindow(RhnRegisterFirstbootGuiWindow):
+ runPriority=106
+ moduleName = _("Set Up Software Updates")
+ windowTitle = moduleName
+ shortMessage = _("Register with Red Hat Network")
+ needsparent = 1
+
+ def __init__(self):
+ RhnRegisterFirstbootGuiWindow.__init__(self)
+ self.start_page = None
+
+ 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 apply(self, *args):
+ """Returns True to change the page (to the one
set)."""
+ if not self.start_page.startPageRegisterNow():
+ dlg = rhnregGui.ConfirmQuitDialog()
+ if not dlg.rc:
+ self.parent.setPage("rhn_start_gui")
+ else:
+ self.parent.setPage("rhn_finish_gui")
+ return True
+
+class KsRegisteredPage:
+
+ def __init__(self):
+ gladefile = "/usr/share/rhn/up2date_client/rh_register.glade"
+ ksRegisteredXml = gtk.glade.XML(gladefile,
"ksRegisteredFirstbootVbox",
+ domain="rhn-client-tools")
+ self.vbox = ksRegisteredXml.get_widget('ksRegisteredFirstbootVbox')
+
+ def startPageVbox(self):
+ return self.vbox
+
+ def startPageRegisterNow(self):
+ return True
+
+
+class NoNetworkPage:
+
+ def __init__(self):
+ gladefile = "/usr/share/rhn/up2date_client/rh_register.glade"
+ noNetworkXml = gtk.glade.XML(gladefile, "noNetworkFirstbootVbox",
+ domain="rhn-client-tools")
+ self.vbox = noNetworkXml.get_widget('noNetworkFirstbootVbox')
+ noNetworkXml.signal_autoconnect({
+ "on_whyRegisterButton_clicked" : self.why_register_button_clicked,
+ })
+
+ def startPageVbox(self):
+ return self.vbox
+
+ def startPageRegisterNow(self):
+ # Sure, we'll register now. heh heh heh
+ # Just continue on past the rhn stuff.
+ return True
+
+ def why_register_button_clicked(self, button):
+ rhnregGui.WhyRegisterDialog()
+
+childWindow = RhnStartWindow
diff --git a/client/rhel/rhn-client-tools/src/firstboot/Makefile
b/client/rhel/rhn-client-tools/src/firstboot/Makefile
index bbd6365..68fd1ac 100644
--- a/client/rhel/rhn-client-tools/src/firstboot/Makefile
+++ b/client/rhel/rhn-client-tools/src/firstboot/Makefile
@@ -16,7 +16,7 @@ INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 --verbose -d
# Install Directories
-FIRSTBOOTDIR = $(PREFIX)/usr/share/firstboot/modules/
+FIRSTBOOTDIR = $(PREFIX)/usr/share/rhn/up2date_client/firstboot/
PYCHECKER = /usr/bin/pychecker
commit 9857430d70a746281db64a054cf4d75390145ca5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue May 25 14:55:46 2010 +0200
593194 - fix creating the $(PREFIX)/usr/share/setuptool/setuptool.d when building the
package.
diff --git a/client/rhel/rhn-client-tools/setuptool.d/Makefile
b/client/rhel/rhn-client-tools/setuptool.d/Makefile
index 8953637..49157f2 100644
--- a/client/rhel/rhn-client-tools/setuptool.d/Makefile
+++ b/client/rhel/rhn-client-tools/setuptool.d/Makefile
@@ -1,7 +1,7 @@
PREFIX ?=
-DIR = /usr/share/setuptool/setuptool.d
+SETUPTOOLDIR = $(PREFIX)/usr/share/setuptool/setuptool.d
# INSTALL scripts
INSTALL = install -p --verbose
@@ -10,11 +10,11 @@ INSTALL_DATA = $(INSTALL) -m 644
all::
-$(DIR):
- @$(INSTALL_DIR) $(PREFIX)$@
+$(SETUPTOOLDIR):
+ @$(INSTALL_DIR) $@
-install:: $(DIR)
- $(INSTALL_DATA) 99rhn_register $(PREFIX)$(DIR)
+install:: $(SETUPTOOLDIR)
+ $(INSTALL_DATA) 99rhn_register $(SETUPTOOLDIR)
clean::
commit bd402896a839a77de381c30ab675b49f5f76bbcd
Author: Colin Coe <colin.coe(a)gmail.com>
Date: Tue May 25 20:23:04 2010 +0800
Correct 'checkstyle' errors
diff --git a/java/code/src/com/redhat/rhn/domain/errata/CveFactory.java
b/java/code/src/com/redhat/rhn/domain/errata/CveFactory.java
index 37ef309..2ce534f 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/CveFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/errata/CveFactory.java
@@ -14,23 +14,12 @@
*/
package com.redhat.rhn.domain.errata;
-import com.redhat.rhn.common.db.datasource.DataResult;
-import com.redhat.rhn.common.db.datasource.ModeFactory;
-import com.redhat.rhn.common.db.datasource.SelectMode;
import com.redhat.rhn.common.hibernate.HibernateFactory;
-import com.redhat.rhn.frontend.listview.ListControl;
-import com.redhat.rhn.frontend.listview.PageControl;
-import org.apache.commons.collections.IteratorUtils;
import org.apache.log4j.Logger;
-import org.hibernate.Session;
import java.util.HashMap;
import java.util.Map;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
/**
* ErrataFactory - the singleton class used to fetch and store
@@ -58,6 +47,7 @@ public class CveFactory extends HibernateFactory {
/**
* Lookup a CVE by name
* @param name Name of CVE to be retrieved
+ * @return CVE object found
*/
public static Cve lookupByName(String name) {
Map params = new HashMap();
commit 013ee43afa07cd7f8b1441e111c98439bd659b1c
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue May 25 13:41:22 2010 +0200
595669 - fix regexp and do not fail if regexp do not match
addressing:
Traceback (most recent call last):
File "/usr/sbin/rhnreg_ks", line 205, in <module>
cli.run()
File "/usr/share/rhn/up2date_client/rhncli.py", line 74, in run
sys.exit(self.main() or 0)
File "/usr/sbin/rhnreg_ks", line 99, in main
hardwareList = hardware.Hardware()
File "/usr/share/rhn/up2date_client/hardware.py", line 667, in Hardware
allhw = get_devices()
File "/usr/share/rhn/up2date_client/hardware_gudev.py", line 93, in
get_devices
result_item['prop1'] = m.group(1) # DEV_HOST
<type 'exceptions.AttributeError'>: 'NoneType' object has no
attribute 'group'
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
index b0dcde3..f2cdd37 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
@@ -85,14 +85,15 @@ def get_devices():
if device.has_property('ID_PATH') or
device.has_property('DEVPATH'):
if device.has_property('ID_PATH'):
path = device.get_property('ID_PATH')
- m = re.search('.*-scsi-(\d+):(\d+):(\d+):(\d+)', path)
+ m = re.search('.*scsi-(\d+):(\d+):(\d+):(\d+)', path)
else: # device.has_property('DEVPATH')
path = device.get_property('DEVPATH')
m = re.search('.*/(\d+):(\d+):(\d+):(\d+)/block/', path)
- result_item['prop1'] = m.group(1) # DEV_HOST
- result_item['prop2'] = m.group(2) # DEV_ID
- result_item['prop3'] = m.group(3) # DEV_CHANNEL
- result_item['prop4'] = m.group(4) # DEV_LUN
+ if m: # do not fail, if regexp did not match
+ result_item['prop1'] = m.group(1) # DEV_HOST
+ result_item['prop2'] = m.group(2) # DEV_ID
+ result_item['prop3'] = m.group(3) # DEV_CHANNEL
+ result_item['prop4'] = m.group(4) # DEV_LUN
result.append(result_item)
return result
commit 43aff12fd21ff355a52dba7a7dd5ece84363a916
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue May 25 13:32:49 2010 +0200
whitespace cleanup
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
index cf08a0a..b0dcde3 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware_gudev.py
@@ -28,7 +28,6 @@ def get_devices():
'detached' : '0'
'class' : 'OTHER'
'desc' : 'Intel Corporation|5000 Series Chipset PCI Express x4 Port
2'
-
"""
# listen to uevents on all subsystems
client = gudev.Client([""])
commit ec9d0a4aeadaa9d529099aeac1651144c576c6d3
Author: Partha Aji <paji(a)redhat.com>
Date: Mon May 24 17:42:44 2010 -0400
Adding the first port of subscribe channels to server stored proc to java
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index ca4de55..3822527 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -1193,5 +1193,41 @@ GROUP BY C.id, C.name
</mode>
+<mode name="lock_current_members">
+ <query params="org_id, cfid">
+ select current_members
+ from rhnPrivateChannelFamily
+ where org_id = :org_id and channel_family_id = :cfid
+ for update of current_members
+ </query>
+</mode>
+
+<mode name="compute_channel_family_curent_members">
+ <query params="org_id, cfid">
+ select count(distinct server_id) as count
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.channel_family_id = :cfid
+ and cfsp.customer_id = :org_id
+ </query>
+</mode>
+<mode name="can_consume_virt_channel">
+ <query params="sid, cfid">
+ select 1
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnVirtualInstance vi
+ where
+ vi.virtual_system_id = :sid
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ and cfvsl.channel_family_id = :cfid
+ and exists (
+ select 1
+ from rhnServerEntitlementView sev
+ where vi.host_system_id = sev.server_id
+ and sev.server_group_type_id = sgtvsl.server_group_type_id )
+ </query>
+</mode>
+
</datasource_modes>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/ErrataCache_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/ErrataCache_queries.xml
index 7d94edf..e353ca8 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/ErrataCache_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/ErrataCache_queries.xml
@@ -49,13 +49,23 @@ DELETE FROM rhnServerNeededCache
</query>
</write-mode>
-<write-mode name="delete_needed_package_cache_all">
+<write-mode name="delete_needed_cache_all">
<query params="server_id">
DELETE FROM rhnServerNeededCache
WHERE server_id = :server_id
</query>
</write-mode>
+<write-mode name="insert_needed_cache_all">
+ <query params="server_id">
+ INSERT INTO rhnServerNeededCache
+ (SELECT server_id, errata_id, package_id
+ FROM rhnServerNeededView
+ WHERE server_id = :server_id)
+ </query>
+</write-mode>
+
+
<write-mode name="insert_needed_errata_cache">
<query params="server_id, errata_id, package_id">
INSERT INTO rhnServerNeededCache
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.hbm.xml
b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.hbm.xml
index 0a3888b..8982b45 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.hbm.xml
@@ -40,7 +40,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
column="VIRT_SUB_LEVEL_ID" />
</set>
- <set name="privateChannelFamilies" inverse="true"
cascade="delete">
+ <set name="channelFamilyOrgAllocations" inverse="true"
cascade="delete">
<key column="channel_family_id"/>
<one-to-many
class="com.redhat.rhn.domain.channel.PrivateChannelFamily"/>
</set>
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
index e749c04..1f1ddfb 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
@@ -23,7 +23,6 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
/**
@@ -31,7 +30,6 @@ import java.util.Set;
* @version $Rev$
*/
public class ChannelFamily extends BaseDomainHelper {
-
private Long id;
private String name;
private String label;
@@ -40,7 +38,8 @@ public class ChannelFamily extends BaseDomainHelper {
private Set<Channel> channels = new HashSet<Channel>();
private Set virtSubscriptionLevels = new HashSet();
- private Set<PrivateChannelFamily> privateChannelFamilies;
+ private Set<PrivateChannelFamily> channelFamilyOrgAllocations =
+ new HashSet<PrivateChannelFamily>();
/**
* @return Returns the channels.
@@ -121,6 +120,22 @@ public class ChannelFamily extends BaseDomainHelper {
}
/**
+ * Returns the channel family allocations for a given org
+ * @param orgIn org for which we need the allocation information
+ * @return the allocation object
+ */
+ public PrivateChannelFamily getChannelFamilyAllocationFor(Org orgIn) {
+ if (this.getChannelFamilyOrgAllocations() != null) {
+ for (PrivateChannelFamily pcf : getChannelFamilyOrgAllocations()) {
+ if (pcf.getOrg().getId().equals(orgIn.getId())) {
+ return pcf;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean equals(final Object other) {
@@ -129,11 +144,11 @@ public class ChannelFamily extends BaseDomainHelper {
}
ChannelFamily castOther = (ChannelFamily) other;
- return new EqualsBuilder().append(id, castOther.id)
- .append(label, castOther.label)
- .append(name, castOther.name)
- .append(org,
castOther.org)
- .append(productUrl, castOther.productUrl)
+ return new EqualsBuilder().append(getId(), castOther.getId())
+ .append(getLabel(), castOther.getLabel())
+ .append(getName(), castOther.getName())
+ .append(getOrg(), castOther.getOrg())
+ .append(getProductUrl(), castOther.getProductUrl())
.isEquals();
}
@@ -141,11 +156,11 @@ public class ChannelFamily extends BaseDomainHelper {
* {@inheritDoc}
*/
public int hashCode() {
- return new HashCodeBuilder().append(id)
- .append(label)
- .append(name)
- .append(org)
- .append(productUrl)
+ return new HashCodeBuilder().append(getId())
+ .append(getLabel())
+ .append(getName())
+ .append(getOrg())
+ .append(getProductUrl())
.toHashCode();
}
@@ -190,18 +205,9 @@ public class ChannelFamily extends BaseDomainHelper {
* @return maxmembers of this channelfamily. NULL == unlimited
*/
public Long getMaxMembers(Org orgIn) {
- Long retval = null;
- if (this.privateChannelFamilies != null &&
- this.privateChannelFamilies.size() > 0) {
- Iterator i = this.privateChannelFamilies.iterator();
- while (i.hasNext()) {
- PrivateChannelFamily pcf = (PrivateChannelFamily) i.next();
- if (pcf.getOrg().getId().equals(orgIn.getId())) {
- retval = pcf.getMaxMembers();
- }
- }
- }
- return retval;
+ PrivateChannelFamily pcf = getChannelFamilyAllocationFor(orgIn);
+ return pcf.getMaxMembers();
+
}
/**
@@ -210,35 +216,46 @@ public class ChannelFamily extends BaseDomainHelper {
* @return currentMembers of this channelfamily.
*/
public Long getCurrentMembers(Org orgIn) {
- Long retval = null;
- if (this.privateChannelFamilies != null &&
- this.privateChannelFamilies.size() > 0) {
- Iterator i = this.privateChannelFamilies.iterator();
- while (i.hasNext()) {
- PrivateChannelFamily pcf = (PrivateChannelFamily) i.next();
- if (pcf.getOrg().equals(orgIn)) {
- retval = pcf.getCurrentMembers();
- }
- }
+ PrivateChannelFamily pcf = getChannelFamilyAllocationFor(orgIn);
+ return pcf.getCurrentMembers();
+ }
+ /**
+ * Update the channelfamily current member counts in a given org
+ * @param orgIn the org to be updated
+ * @param currentMembersIn the current members
+ */
+ public void setCurrentMembers(Org orgIn, Long currentMembersIn) {
+ getChannelFamilyAllocationFor(orgIn).setCurrentMembers(currentMembersIn);
+ }
+
+ /**
+ * Returns true if there are ant available subscriptions
+ * @param orgIn the org which needs to be checked
+ * @return true if there are ant available subscriptions
+ */
+ public boolean hasAvailableSlots(Org orgIn) {
+ Long max = getMaxMembers(orgIn);
+ //max = null means infinite slots
+ if (max == null) {
+ return true;
}
- return retval;
+ return max - getCurrentMembers(orgIn) > 0;
}
-
/**
* @return Returns the privateChannelFamilies.
*/
- public Set<PrivateChannelFamily> getPrivateChannelFamilies() {
- return privateChannelFamilies;
+ public Set<PrivateChannelFamily> getChannelFamilyOrgAllocations() {
+ return channelFamilyOrgAllocations;
}
/**
* @param privateChannelFamiliesIn The privateChannelFamilies to set.
*/
- protected void setPrivateChannelFamilies(
+ protected void setChannelFamilyOrgAllocations(
Set<PrivateChannelFamily> privateChannelFamiliesIn) {
- this.privateChannelFamilies = privateChannelFamiliesIn;
+ this.channelFamilyOrgAllocations = privateChannelFamiliesIn;
}
/**
@@ -246,12 +263,11 @@ public class ChannelFamily extends BaseDomainHelper {
* @param pcfIn to set
*/
public void addPrivateChannelFamily(PrivateChannelFamily pcfIn) {
- if (this.privateChannelFamilies == null) {
- this.privateChannelFamilies = new HashSet<PrivateChannelFamily>();
+ if (this.channelFamilyOrgAllocations == null) {
+ this.channelFamilyOrgAllocations = new
HashSet<PrivateChannelFamily>();
}
- this.privateChannelFamilies.add(pcfIn);
+ this.channelFamilyOrgAllocations.add(pcfIn);
}
-
}
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/multiorg/test/OrgSoftwareSubscriptionsActionTest.java
b/java/code/src/com/redhat/rhn/frontend/action/multiorg/test/OrgSoftwareSubscriptionsActionTest.java
index 796d5d7..a38e7f0 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/multiorg/test/OrgSoftwareSubscriptionsActionTest.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/multiorg/test/OrgSoftwareSubscriptionsActionTest.java
@@ -57,7 +57,7 @@ public class OrgSoftwareSubscriptionsActionTest extends
RhnMockStrutsTestCase {
assertTrue(getActualForward().contains("oid=" +
user.getOrg().getId()));
verifyActionMessage("org.entitlements.syssoft.success");
cfm = (ChannelFamily) TestUtils.reload(cfm);
- Iterator i = cfm.getPrivateChannelFamilies().iterator();
+ Iterator i = cfm.getChannelFamilyOrgAllocations().iterator();
while (i.hasNext()) {
TestUtils.reload(i.next());
}
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 9b1bea6..4789a27 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -7639,6 +7639,7 @@ Follow this url to see the full list of inactive systems:
<context
context-type="sourcefile">/rhn/systems/details/SystemChannels.do</context>
</context-group>
</trans-unit>
+
<trans-unit id="sdc.channels.edit.failed_channels">
<source>Note: Some channel subscriptions could not be updated because there were
no available subscriptions.</source>
@@ -7653,7 +7654,6 @@ Follow this url to see the full list of inactive systems:
</context-group>
</trans-unit>
-
<trans-unit id="softwareEntitlementSubs.successMessage">
<source>Updated entitlement count for '{0}'</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/ChannelHandler.java
b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/ChannelHandler.java
index 6410039..d7a300b 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/ChannelHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/ChannelHandler.java
@@ -232,4 +232,19 @@ public class ChannelHandler extends BaseHandler {
dr.elaborate();
return dr.toArray();
}
+
+ /**
+ * TODO
+ * @param sessionKey TODO
+ * @param serverId TODO
+ * @param channelId TODO
+ * @param options TODO
+ * @return TODO
+ */
+ public int subscribeServer(String sessionKey, Integer serverId,
+ Integer channelId, Map<String, Object> options) {
+ return 1;
+
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index 3544c67..02001dd 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -1013,7 +1013,7 @@ public class ChannelManager extends BaseManager {
msg.append(" either does not have subscribe privileges to Channel:
");
msg.append(cid);
msg.append(" or ChannelManager.QRY_ROLE_SUBSCRIBE is defined
wrong.");
- log.debug(msg.toString(), e);
+ log.warn(msg.toString(), e);
return false;
}
}
@@ -2831,5 +2831,6 @@ public class ChannelManager extends BaseManager {
Collections.sort(possibleList);
return logPath + possibleList.get(possibleList.size() - 1);
}
+
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelProcedure.java
b/java/code/src/com/redhat/rhn/manager/channel/ChannelProcedure.java
new file mode 100644
index 0000000..829a690
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelProcedure.java
@@ -0,0 +1,212 @@
+/**
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.manager.channel;
+
+import com.redhat.rhn.common.db.datasource.DataResult;
+import com.redhat.rhn.common.db.datasource.ModeFactory;
+import com.redhat.rhn.common.db.datasource.SelectMode;
+import com.redhat.rhn.common.localization.LocalizationService;
+import com.redhat.rhn.common.security.PermissionException;
+import com.redhat.rhn.domain.channel.Channel;
+import com.redhat.rhn.domain.channel.ChannelFamily;
+import
com.redhat.rhn.domain.org.Org;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.server.ServerHistoryEvent;
+import com.redhat.rhn.domain.task.Task;
+import com.redhat.rhn.domain.task.TaskFactory;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.manager.errata.cache.ErrataCacheManager;
+import com.redhat.rhn.manager.system.IncompatibleArchException;
+import com.redhat.rhn.manager.system.SystemManager;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * ChannelProcedure
+ * @version $Rev$
+ */
+public class ChannelProcedure {
+ private static final ChannelProcedure INSTANCE = new ChannelProcedure();
+
+ private ChannelProcedure() {
+
+ }
+
+ /**
+ * @return an instance of the channle procedure objects
+ */
+ public static ChannelProcedure getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Executes the procedure to subscribe a channel to a server
+ * @param user The user object needs to have subscribe permissions
+ * @param server server object
+ * @param channel the channel to subscribe
+ */
+ public void subscribeServer(User user, Server server,
+ Channel channel) {
+ subscribeServer(user, server, channel, false);
+ }
+
+ /**
+ * Executes the procedure to subscribe a channel to a server
+ * @param user The user object needs to have subscribe permissions
+ * @param server server object
+ * @param channel the channel to subscribe
+ * @param asyncCacheUpdate update the cache asynchronously. False to update
immediately
+ */
+ public void subscribeServer(User user, Server server,
+ Channel channel, boolean asyncCacheUpdate) {
+
+ // do not allow non-satellite or non-proxy servers to
+ // be subscribed to satellite or proxy channels respectively.
+ if (channel.isSatellite()) {
+ if (!server.isSatellite()) {
+ return;
+ }
+ }
+ else if (channel.isProxy()) {
+ if (!server.isProxy()) {
+ return;
+ }
+ }
+
+ if (!SystemManager.verifyArchCompatibility(server, channel)) {
+ throw new IncompatibleArchException(
+ server.getServerArch(), channel.getChannelArch());
+ }
+
+ if (user != null &&
+ !ChannelManager.verifyChannelSubscribe(user, channel.getId())) {
+ //Throw an exception with a nice error message so the user
+ //knows what went wrong.
+ LocalizationService ls = LocalizationService.getInstance();
+ PermissionException pex = new PermissionException("User does not
have" +
+ " permission to subscribe this server to this channel.");
+
pex.setLocalizedTitle(ls.getMessage("permission.jsp.title.subscribechannel"));
+ pex.setLocalizedSummary(
+ ls.getMessage("permission.jsp.summary.subscribechannel"));
+ throw pex;
+ }
+ if (!channel.isBaseChannel()) {
+ //make sure that the parent is subscribed to the server
+ if (!channel.getParentChannel().equals(server.getBaseChannel())) {
+ return;
+ }
+ }
+ else if (server.getBaseChannel() != null) {
+ String msg = "Attempted to subscribe a base channel [%s] while the"
+
+ " system [%s] is already subscribed to
[%s]";
+ throw new ChannelSubscriptionException(String.format(msg,
+ channel, server, server.getBaseChannel()));
+ }
+
+ if (server.isSubscribed(channel)) {
+ //already subscribed no worries :)
+ return;
+ }
+ if (channel.getChannelFamily() == null) {
+ String msg = "No channel family for channel [%s] while" +
+ " attempting to subscribe to system [%s] ";
+ throw new ChannelSubscriptionException(String.format(msg,
+ channel, server));
+ }
+
+ // Use the org_id of the server only if the org_id of the channel = NULL.
+ // This is required for subscribing to shared channels.
+ Org org = (channel.getOrg() == null) ? server.getOrg() : channel.getOrg();
+ //need do a select for update Lock on current Members
+
+ lockCurrentMembers(channel.getChannelFamily(), org);
+ if (channel.getChannelFamily().hasAvailableSlots(org) ||
+ canConsumeVirtChannels(server, channel)) {
+ ServerHistoryEvent event = new ServerHistoryEvent();
+ event.setCreated(new Date());
+ event.setServer(server);
+ int summaryColumnLength = 128;
+ String summary = "subscribed to channel " + channel.getLabel();
+ event.setSummary(summary.substring(0,
+ Math.min(summary.length(), summaryColumnLength)));
+ event.setDetails(channel.getLabel());
+ server.getHistory().add(event);
+ server.addChannel(channel);
+ server.setChannelsChanged(new Date());
+ SystemManager.storeServer(server);
+ updateChannelFamilyCounts(channel.getChannelFamily(), org);
+ updateServerCache(server, asyncCacheUpdate);
+ }
+ else {
+ String msg = "No slots available for the following channel family
[%s]";
+ throw new ChannelSubscriptionException(String.format(msg,
+ channel.getChannelFamily()));
+ }
+ }
+
+ private boolean canConsumeVirtChannels(Server serverIn, Channel channelIn) {
+ SelectMode m = ModeFactory.getMode("Channel_queries",
+ "can_consume_virt_channel");
+ Map params = new HashMap();
+ params.put("cfid", channelIn.getChannelFamily().getId());
+ params.put("sid", serverIn.getId());
+ DataResult dr = m.execute(params);
+ return !dr.isEmpty();
+ }
+
+ private void updateServerCache(Server serverIn, boolean asyncCacheUpdate) {
+ if (asyncCacheUpdate) {
+ Task task = new Task();
+ task.setOrg(serverIn.getOrg());
+ task.setName("update_server_errata_cache");
+ task.setData(serverIn.getId());
+ TaskFactory.save(task);
+ }
+ else {
+ ErrataCacheManager.deleteServerNeededCache(serverIn.getId());
+ ErrataCacheManager.insertServerNeededCache(serverIn.getId());
+ }
+ }
+
+ private void lockCurrentMembers(ChannelFamily channelFamilyIn, Org orgIn) {
+ SelectMode m = ModeFactory.getMode("Channel_queries",
+ "lock_current_members");
+ Map params = new HashMap();
+ params.put("org_id", orgIn.getId());
+ params.put("cfid", channelFamilyIn.getId());
+ m.execute(params);
+ }
+
+ private void updateChannelFamilyCounts(ChannelFamily channelFamilyIn,
+ Org orgIn) {
+ Long currentMembers = computeCurrentMemberCounts(channelFamilyIn, orgIn);
+ channelFamilyIn.setCurrentMembers(orgIn, currentMembers);
+ }
+
+ private long computeCurrentMemberCounts(ChannelFamily channelFamilyIn,
+ Org orgIn) {
+ SelectMode m = ModeFactory.getMode("Channel_queries",
+ "compute_channel_family_curent_members");
+ Map params = new HashMap();
+ params.put("cfid", channelFamilyIn.getId());
+ params.put("org_id", orgIn.getId());
+ DataResult<Map<String, Object>> dr = m.execute(params);
+ return (Long) dr.get(0).get("count");
+
+ }
+}
diff --git
a/java/code/src/com/redhat/rhn/manager/channel/ChannelSubscriptionException.java
b/java/code/src/com/redhat/rhn/manager/channel/ChannelSubscriptionException.java
new file mode 100644
index 0000000..f7d145e
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelSubscriptionException.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.manager.channel;
+
+import com.redhat.rhn.common.RhnRuntimeException;
+
+
+/**
+ * ChannelSubscriptionException
+ * @version $Rev$
+ */
+public class ChannelSubscriptionException extends RhnRuntimeException {
+
+ /**
+ * Comment for <code>serialVersionUID</code>
+ */
+ private static final long serialVersionUID = -3182620870243879194L;
+
+ /**
+ *
+ */
+ public ChannelSubscriptionException() {
+ }
+
+ /**
+ * @param msg An error message
+ */
+ public ChannelSubscriptionException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * @param t The Throwable to wrap
+ */
+ public ChannelSubscriptionException(Throwable t) {
+ super(t);
+ }
+
+ /**
+ * @param msg An error message
+ * @param t The Throwable to wrap
+ */
+ public ChannelSubscriptionException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java
b/java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java
index 64ee977..2165cbb 100644
--- a/java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java
+++ b/java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java
@@ -173,19 +173,32 @@ public class ErrataCacheManager extends HibernateFactory {
}
/**
- * Delete all records from NeededPackage cache for the server provided.
+ * Inserts all records from ServerNeeded cache for the server provided.
* @param sid Server Id
* @return number of rows affected.
*/
- public static int deleteNeededPackageCache(Long sid) {
+ public static int deleteServerNeededCache(Long sid) {
WriteMode m = ModeFactory.getWriteMode("ErrataCache_queries",
- "delete_needed_package_cache_all");
+ "delete_needed_cache_all");
Map params = new HashMap();
params.put("server_id", sid);
return m.executeUpdate(params);
}
/**
+ * Delete all records from Server Needed cache for the server provided.
+ * @param sid Server Id
+ * @return number of rows affected.
+ */
+ public static int insertServerNeededCache(Long sid) {
+ WriteMode m = ModeFactory.getWriteMode("ErrataCache_queries",
+ "insert_needed_cache_all");
+ Map params = new HashMap();
+ params.put("server_id", sid);
+ return m.executeUpdate(params);
+ }
+
+ /**
* Inserts record into NeededErrata cache table
* @param sid Server Id
* @param eid Errata Id
diff --git a/java/code/src/com/redhat/rhn/manager/org/MigrationManager.java
b/java/code/src/com/redhat/rhn/manager/org/MigrationManager.java
index 6dece78..459363e 100644
--- a/java/code/src/com/redhat/rhn/manager/org/MigrationManager.java
+++ b/java/code/src/com/redhat/rhn/manager/org/MigrationManager.java
@@ -158,7 +158,7 @@ public class MigrationManager extends BaseManager {
// Remove the errata and package cache
ErrataCacheManager.deleteNeededErrataCache(server.getId());
- ErrataCacheManager.deleteNeededPackageCache(server.getId());
+ ErrataCacheManager.deleteServerNeededCache(server.getId());
// Remove snapshots
List<ServerSnapshot> snapshots = ServerFactory.listSnapshots(
diff --git
a/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
b/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
index f69ab00..8028b0b 100644
---
a/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
+++
b/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
@@ -42,7 +42,7 @@ public class UpdateOrgSoftwareEntitlementsTest extends
BaseTestCaseWithUser {
private void reloadFamilies() {
fam = (ChannelFamily) reload(fam);
- Iterator i = fam.getPrivateChannelFamilies().iterator();
+ Iterator i = fam.getChannelFamilyOrgAllocations().iterator();
while (i.hasNext()) {
TestUtils.reload(i.next());
}
@@ -75,7 +75,7 @@ public class UpdateOrgSoftwareEntitlementsTest extends
BaseTestCaseWithUser {
fam.getLabel(), user.getOrg(), firstAllocation);
assertNull(cmd.store());
TestUtils.reload(fam);
- for (PrivateChannelFamily privFam : fam.getPrivateChannelFamilies()) {
+ for (PrivateChannelFamily privFam : fam.getChannelFamilyOrgAllocations()) {
if (privFam.getOrg().getId().equals(OrgFactory.getSatelliteOrg().getId())) {
TestUtils.reload(privFam);
}
@@ -127,7 +127,7 @@ public class UpdateOrgSoftwareEntitlementsTest extends
BaseTestCaseWithUser {
}
public void testNullChanFam() throws Exception {
- Iterator i = fam.getPrivateChannelFamilies().iterator();
+ Iterator i = fam.getChannelFamilyOrgAllocations().iterator();
while (i.hasNext()) {
PrivateChannelFamily p = (PrivateChannelFamily) i.next();
if (p.getOrg().getId().equals(user.getOrg().getId())) {
diff --git a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
index be532f1..edeb6d5 100644
--- a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
+++ b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
@@ -68,6 +68,7 @@ import com.redhat.rhn.frontend.xmlrpc.ProxySystemIsSatelliteException;
import com.redhat.rhn.manager.BaseManager;
import com.redhat.rhn.manager.action.ActionManager;
import com.redhat.rhn.manager.channel.ChannelManager;
+import com.redhat.rhn.manager.channel.ChannelProcedure;
import com.redhat.rhn.manager.channel.MultipleChannelsWithPackageException;
import com.redhat.rhn.manager.entitlement.EntitlementManager;
import com.redhat.rhn.manager.rhnset.RhnSetDecl;
@@ -1132,67 +1133,8 @@ public class SystemManager extends BaseManager {
Server server,
Channel channel,
boolean flush) {
-
- // do not allow non-satellite or non-proxy servers to
- // be subscribed to satellite or proxy channels respectively.
- if (channel.isSatellite()) {
- if (!server.isSatellite()) {
- return server;
- }
- }
- else if (channel.isProxy()) {
- if (!server.isProxy()) {
- return server;
- }
- }
-
- if (user != null && !ChannelManager.verifyChannelSubscribe(user,
channel.getId())) {
- //Throw an exception with a nice error message so the user
- //knows what went wrong.
- LocalizationService ls = LocalizationService.getInstance();
- PermissionException pex = new PermissionException("User does not
have" +
- " permission to subscribe this server to this channel.");
-
pex.setLocalizedTitle(ls.getMessage("permission.jsp.title.subscribechannel"));
- pex.setLocalizedSummary(
- ls.getMessage("permission.jsp.summary.subscribechannel"));
- throw pex;
- }
-
- if (!verifyArchCompatibility(server, channel)) {
- throw new IncompatibleArchException(
- server.getServerArch(), channel.getChannelArch());
- }
-
- log.debug("calling subscribe_server_to_channel");
- CallableMode m = ModeFactory.getCallableMode("Channel_queries",
- "subscribe_server_to_channel");
-
- Map in = new HashMap();
- in.put("server_id", server.getId());
- if (user != null) {
- in.put("user_id", user.getId());
- }
- else {
- in.put("user_id", null);
- }
- in.put("channel_id", channel.getId());
-
- m.execute(in, new HashMap());
-
- /*
- * This is f-ing hokey, but we need to be sure to refresh the
- * server object since
- * we modified it outside of hibernate :-/
- * This will update the server.channels set.
- */
- log.debug("returning with a flush? " + flush);
- if (flush) {
- return (Server) HibernateFactory.reload(server);
- }
- else {
- HibernateFactory.getSession().refresh(server);
- return server;
- }
+ ChannelProcedure.getInstance().subscribeServer(user, server, channel);
+ return server;
}
/**
commit 49c09c532518cd1368ff7bed1d1dc5f1a4ac5667
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon May 24 12:26:15 2010 -0400
checkstyle fixes
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ssm/SchedulePackageUpgradeAction.java
b/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ssm/SchedulePackageUpgradeAction.java
index 5bdaeb2..1c3319c 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ssm/SchedulePackageUpgradeAction.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/rhnpackage/ssm/SchedulePackageUpgradeAction.java
@@ -15,17 +15,14 @@
package com.redhat.rhn.frontend.action.rhnpackage.ssm;
import com.redhat.rhn.common.db.datasource.DataResult;
-
import com.redhat.rhn.common.messaging.MessageQueue;
import com.redhat.rhn.common.util.DatePicker;
import com.redhat.rhn.domain.rhnpackage.PackageEvr;
import com.redhat.rhn.domain.rhnset.RhnSet;
-import com.redhat.rhn.domain.rhnset.SetCleanup;
import com.redhat.rhn.domain.rhnset.RhnSetElement;
+import com.redhat.rhn.domain.rhnset.SetCleanup;
import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.frontend.dto.PackageDto;
import com.redhat.rhn.frontend.dto.PackageListItem;
-
import com.redhat.rhn.frontend.events.SsmUpgradePackagesEvent;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
@@ -40,7 +37,6 @@ import com.redhat.rhn.manager.rhnset.RhnSetManager;
import com.redhat.rhn.manager.system.SystemManager;
import org.apache.commons.lang.StringUtils;
-
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
@@ -49,12 +45,12 @@ import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.DynaActionForm;
+import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -114,7 +110,8 @@ public class SchedulePackageUpgradeAction extends RhnAction implements
Listable
for (String idCombo : data) {
PackageListItem item = PackageListItem.parse(idCombo);
- PackageListItem existing = packageNameIdsToItems.get(item.getIdOne() +
"|"+ item.getIdThree());
+ PackageListItem existing =
+ packageNameIdsToItems.get(item.getIdOne() + "|" +
item.getIdThree());
if (existing != null) {
String[] existingParts = splitEvr(existing.getNvre());
String[] itemParts = splitEvr(item.getNvre());
@@ -130,11 +127,13 @@ public class SchedulePackageUpgradeAction extends RhnAction
implements Listable
itemEvr.setRelease(itemParts[2]);
if (existingEvr.compareTo(itemEvr) < 0) {
- packageNameIdsToItems.put(item.getIdOne() + "|"+
item.getIdThree(), item);
+ packageNameIdsToItems.put(item.getIdOne() + "|" +
+ item.getIdThree(), item);
}
}
else {
- packageNameIdsToItems.put(item.getIdOne() + "|"+
item.getIdThree(), item);
+ packageNameIdsToItems.put(item.getIdOne() + "|" +
+ item.getIdThree(), item);
}
}