diff --git a/rel-eng/packages/subscription-manager b/rel-eng/packages/subscription-manager
index 9f6984a..e58ffb0 100644
--- a/rel-eng/packages/subscription-manager
+++ b/rel-eng/packages/subscription-manager
@@ -1 +1 @@
-1.15.9-8 ./
+1.15.9-9 ./
diff --git a/src/subscription_manager/gui/registergui.py b/src/subscription_manager/gui/registergui.py
index 3ba0fff..08168b2 100644
--- a/src/subscription_manager/gui/registergui.py
+++ b/src/subscription_manager/gui/registergui.py
@@ -316,8 +316,7 @@ class RegisterWidget(widgets.SubmanBaseWidget):
# Unset backend from attempting to use basic auth
if activation_keys:
- self.async.cp_provider.set_user_pass()
- self.async.update()
+ self.async.set_user_pass()
def _on_details_label_txt_change(self, obj, value):
"""Update the label under the progress bar on progress page."""
@@ -509,42 +508,55 @@ class RegisterDialog(widgets.SubmanBaseWidget):
self.connect_signals(callbacks)
self.reg_info = RegisterInfo()
- # FIXME: Need better error handling in general, but it's kind of
- # annoying to have to pass the top level widget all over the place
- self.register_widget = RegisterWidget(backend, facts,
- reg_info=self.reg_info,
- parent_window=self.register_dialog)
-
- # Ensure that we start on the first page and that
- # all widgets are cleared.
- self.register_widget.initialize()
+ # RegisterWidget is a oect, but not a Gtk.Widget
+ self.register_widget = self.create_register_widget(backend, facts, self.reg_info,
+ self.register_dialog)
+ # But RegisterWidget.register_widget is a Gtk.Widget, so add it to
+ # out container
self.register_dialog_main_vbox.pack_start(self.register_widget.register_widget,
True, True, 0)
+ # reset/clear/setup
+ self.register_widget.initialize()
+
self.register_button.connect('clicked', self._on_register_button_clicked)
self.cancel_button.connect('clicked', self.cancel)
+ self.window = self.register_dialog
+
+ # FIXME: needed by firstboot
+ self.password = None
+
+ def create_register_widget(self, backend, facts, reg_info, parent_window):
+
+ # FIXME: Need better error handling in general, but it's kind of
+ # annoying to have to pass the top level widget all over the place
+ register_widget = RegisterWidget(backend=backend,
+ facts=facts,
+ reg_info=reg_info,
+ parent_window=parent_window)
+
+ # Ensure that we start on the first page and that
+ # all widgets are cleared.
+ register_widget.initialize()
+
# initial-setup will likely handle these itself
- self.register_widget.connect('finished', self.cancel)
- self.register_widget.connect('register-error', self.on_register_error)
+ register_widget.connect('finished', self.cancel)
+ register_widget.connect('register-error', self.on_register_error)
# update window title on register state changes
- self.register_widget.info.connect('notify::register-state',
- self._on_register_state_change)
+ register_widget.info.connect('notify::register-state',
+ self._on_register_state_change)
# update the 'next/register button on page change'
- self.register_widget.connect('notify::register-button-label',
- self._on_register_button_label_change)
-
- self.window = self.register_dialog
+ register_widget.connect('notify::register-button-label',
+ self._on_register_button_label_change)
- # FIXME: needed by firstboot
- self.password = None
+ return register_widget
def initialize(self):
- self.register_widget.clear_screens()
- # self.register_widget.initialize()
+ self.register_widget.initialize()
def show(self):
# initial-setup module skips this, since it results in a
@@ -1436,7 +1448,7 @@ class AsyncBackend(object):
def update(self):
self.backend.update()
- def set_user_pass(self, username, password):
+ def set_user_pass(self, username=None, password=None):
self.backend.cp_provider.set_user_pass(username, password)
self.backend.update()
diff --git a/src/subscription_manager/managercli.py b/src/subscription_manager/managercli.py
index 3933c30..c23e0d8 100644
--- a/src/subscription_manager/managercli.py
+++ b/src/subscription_manager/managercli.py
@@ -1917,7 +1917,7 @@ class ReposCommand(CliCommand):
def _do_command(self):
self._validate_options()
rc = 0
- if cfg.has_option('rhsm', 'manage_repos') and not int(cfg.get('rhsm', 'manage_repos')):
+ if cfg.has_option('rhsm', 'manage_repos') and not cfg.get_int('rhsm', 'manage_repos'):
print _("Repositories disabled by configuration.")
return rc
diff --git a/src/subscription_manager/repolib.py b/src/subscription_manager/repolib.py
index fdbcf80..f07dac6 100644
--- a/src/subscription_manager/repolib.py
+++ b/src/subscription_manager/repolib.py
@@ -191,7 +191,7 @@ class RepoUpdateActionCommand(object):
self.manage_repos = 1
self.apply_overrides = apply_overrides
if CFG.has_option('rhsm', 'manage_repos'):
- self.manage_repos = int(CFG.get('rhsm', 'manage_repos'))
+ self.manage_repos = CFG.get_int('rhsm', 'manage_repos')
self.release = None
self.overrides = {}
@@ -684,7 +684,7 @@ class RepoFile(ConfigParser):
self.repos_dir = Path.abs(self.PATH)
self.manage_repos = 1
if CFG.has_option('rhsm', 'manage_repos'):
- self.manage_repos = int(CFG.get('rhsm', 'manage_repos'))
+ self.manage_repos = CFG.get_int('rhsm', 'manage_repos')
# Simulate manage repos turned off if no yum.repos.d directory exists.
# This indicates yum is not installed so clearly no need for us to
# manage repos.
diff --git a/subscription-manager.spec b/subscription-manager.spec
index e6d4b1d..04b915a 100644
--- a/subscription-manager.spec
+++ b/subscription-manager.spec
@@ -49,7 +49,7 @@
Name: subscription-manager
Version: 1.15.9
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: Tools and libraries for subscription and repository management
Group: System Environment/Base
License: GPLv2
@@ -542,6 +542,14 @@ fi
%endif
%changelog
+* Thu Sep 10 2015 Chris Rog <crog@redhat.com> 1.15.9-9
+- 1261572: Re-initialize() RegisterWidget on RegDialog show
+ (alikins@redhat.com)
+- 1254550: Fix activation key usage in gui. (alikins@redhat.com)
+- 1251853: Manage repos config entry needs to allow blank value
+ (wpoteat@redhat.com)
+- Use Notebook 'page' prop notify signal for tests (alikins@redhat.com)
+
* Wed Sep 02 2015 Chris Rog <crog@redhat.com> 1.15.9-8
- 884288: Better registergui for initial-setup (alikins@redhat.com)
- Fix 'make gladelint' errors in repositories.glade (alikins@redhat.com)
diff --git a/test/stubs.py b/test/stubs.py
index 36c8888..a8cd338 100644
--- a/test/stubs.py
+++ b/test/stubs.py
@@ -442,7 +442,7 @@ class StubUEP(object):
def getCertificateSerials(self, consumer):
return []
- def getCompliance(self, uuid):
+ def getCompliance(self, uuid, on_data=None):
return {}
def getEntitlementList(self, uuid):
diff --git a/test/test_registrationgui.py b/test/test_registrationgui.py
index 9374325..ad497af 100644
--- a/test/test_registrationgui.py
+++ b/test/test_registrationgui.py
@@ -11,10 +11,14 @@ from subscription_manager.gui.registergui import RegisterWidget, \
from subscription_manager.ga import GObject as ga_GObject
from subscription_manager.ga import Gtk as ga_Gtk
+import sys
+
class RegisterWidgetTests(SubManFixture):
def setUp(self):
super(RegisterWidgetTests, self).setUp()
+ self.exc_infos = []
+ self.excs = []
self.backend = StubBackend()
expected_facts = {'fact1': 'one',
'fact2': 'two',
@@ -33,43 +37,79 @@ class RegisterWidgetTests(SubManFixture):
def test_show(self):
self.rs.initialize()
- # FIXME: unit tests for gtk is a weird universe
- def test_registration_error_returns_to_page(self):
- self.rs.initialize()
+ def page_notify_handler(self, obj, param):
+ page_after = obj.get_current_page()
+ # NOTE: these exceptions are not in the nost test context,
+ # so they don't actually fail nose
+ try:
+ self.assertEquals(page_after, 0)
+ except Exception:
+ self.exc_infos.append(sys.exc_info())
+ return
- self.correct_page = None
+ self.correct_page = True
+ self.gtk_quit()
+ return False
- def error_handler(obj, msg, exc_info):
- page_after = self.rs.register_notebook.get_current_page()
+ def error_handler(self, obj, msg, exc_info):
+ page_after = self.rs.register_notebook.get_current_page()
- # NOTE: these exceptions are not in the nost test context,
- # so they don't actually fail nose
+ # NOTE: these exceptions are not in the nost test context,
+ # so they don't actually fail nose
+ try:
self.assertEquals(page_after, 0)
- self.correct_page = True
- self.quit()
+ except Exception:
+ self.exc_infos.append(sys.exc_info())
+ return
+
+ self.correct_page = True
+ self.gtk_quit()
+ return False
+
+ def emit_proceed(self):
+ self.rs.emit('proceed')
+ return False
+
+ def emit_error(self):
+ self.rs.emit('register-error', 'Some register error', None)
+ return False
- def emit_proceed():
- self.rs.emit('proceed')
- return False
+ # FIXME: unit tests for gtk is a weird universe
+ def test_registration_error_returns_to_page(self):
+ self.rs.initialize()
+
+ self.correct_page = None
- def emit_error():
- self.rs.emit('register-error', 'Some register error', None)
- return False
+ self.rs.register_notebook.connect('notify::page', self.page_notify_handler)
- self.rs.connect('register-error', error_handler)
+ self.rs.connect('register-error', self.error_handler)
- ga_GObject.timeout_add(250, self.quit)
- ga_GObject.idle_add(emit_proceed)
- ga_GObject.idle_add(emit_error)
+ ga_GObject.timeout_add(3000, self.gtk_quit_on_fail)
+ ga_GObject.idle_add(self.emit_proceed)
+ ga_GObject.idle_add(self.emit_error)
# run till quit or timeout
# if we get to the state we want we can call quit
ga_Gtk.main()
- # verify class scope self.correct_page got set correct in error handler
+ # If we saw any exceptions, raise them now so we fail nosetests
+ for exc_info in self.exc_infos:
+ raise exc_info[1], None, exc_info[2]
+
self.assertTrue(self.correct_page)
- def quit(self):
+ # if we got the right answer, go ahead and end gtk.main()
+ def gtk_quit(self):
+ ga_Gtk.main_quit()
+
+ # End the main loop, but first add an exception to sys.exc_info so
+ # the end of the tests can fail on it.
+ def gtk_quit_on_fail(self):
+ try:
+ self.fail("registergui didn't get a signal before the timeout.")
+ except Exception:
+ self.exc_infos.append(sys.exc_info())
+
ga_Gtk.main_quit()