diff --git a/rel-eng/packages/subscription-manager b/rel-eng/packages/subscription-manager
index 25c7507..c481ba3 100644
--- a/rel-eng/packages/subscription-manager
+++ b/rel-eng/packages/subscription-manager
@@ -1 +1 @@
-1.15.9-14 ./
+1.15.9-15 ./
diff --git a/src/subscription_manager/gui/about.py b/src/subscription_manager/gui/about.py
index d8da8a8..323679c 100644
--- a/src/subscription_manager/gui/about.py
+++ b/src/subscription_manager/gui/about.py
@@ -54,6 +54,7 @@ class AboutDialog(object):
self.dialog.set_copyright(_("Copyright (c) 2012 Red Hat, Inc."))
self.dialog.set_logo_icon_name("subscription-manager")
self.dialog.set_icon_name("subscription-manager")
+ self.dialog.set_authors(["The Subscription Manager Team"])
next_update_label = ga_Gtk.Label()
python_rhsm_version_label = ga_Gtk.Label()
diff --git a/src/subscription_manager/gui/managergui.py b/src/subscription_manager/gui/managergui.py
index 8a0498e..386b10c 100644
--- a/src/subscription_manager/gui/managergui.py
+++ b/src/subscription_manager/gui/managergui.py
@@ -370,7 +370,8 @@ class MainWindow(widgets.SubmanBaseWidget):
registration_dialog.show()
def _on_dialog_destroy(self, obj, widget):
- widget.set_sensitive(True)
+ if widget:
+ widget.set_sensitive(True)
return False
def _preferences_item_clicked(self, widget):
diff --git a/src/subscription_manager/managercli.py b/src/subscription_manager/managercli.py
index 8054880..a1b806d 100644
--- a/src/subscription_manager/managercli.py
+++ b/src/subscription_manager/managercli.py
@@ -49,7 +49,7 @@ from subscription_manager.jsonwrapper import PoolWrapper
from subscription_manager import managerlib
from subscription_manager.managerlib import valid_quantity, format_date
from subscription_manager.release import ReleaseBackend
-from subscription_manager.repolib import RepoActionInvoker, RepoFile
+from subscription_manager.repolib import RepoActionInvoker, RepoFile, manage_repos_enabled
from subscription_manager.utils import parse_server_info, \
parse_baseurl_info, format_baseurl, is_valid_server_info, \
MissingCaCertException, get_client_versions, get_server_versions, \
@@ -258,10 +258,6 @@ def get_installed_product_status(product_directory, entitlement_directory, uep,
return product_status
-def managed_repos_disabled():
- return cfg.has_option('rhsm', 'manage_repos') and not int(cfg.get('rhsm', 'manage_repos'))
-
-
class CliCommand(AbstractCLICommand):
""" Base class for all sub-commands. """
@@ -1924,7 +1920,7 @@ class ReposCommand(CliCommand):
def _do_command(self):
self._validate_options()
rc = 0
- if managed_repos_disabled():
+ if not manage_repos_enabled():
print _("Repositories disabled by configuration.")
return rc
@@ -2484,7 +2480,7 @@ class OverrideCommand(CliCommand):
overrides = Overrides()
- if managed_repos_disabled():
+ if not manage_repos_enabled():
print _("Repositories disabled by configuration.")
if self.options.list:
diff --git a/src/subscription_manager/repolib.py b/src/subscription_manager/repolib.py
index f07dac6..6c7d10d 100644
--- a/src/subscription_manager/repolib.py
+++ b/src/subscription_manager/repolib.py
@@ -16,6 +16,8 @@
# in this software or its documentation.
#
+# TODO: cleanup config parser imports
+from ConfigParser import Error as ConfigParserError
import gettext
from iniparse import RawConfigParser as ConfigParser
import logging
@@ -43,6 +45,23 @@ ALLOWED_CONTENT_TYPES = ["yum"]
_ = gettext.gettext
+def manage_repos_enabled():
+ manage_repos = True
+ try:
+ manage_repos = CFG.get_int('rhsm', 'manage_repos')
+ except ValueError, e:
+ log.exception(e)
+ return True
+ except ConfigParserError, e:
+ log.exception(e)
+ return True
+
+ if manage_repos is None:
+ return True
+
+ return bool(manage_repos)
+
+
class RepoActionInvoker(BaseActionInvoker):
"""Invoker for yum repo updating related actions."""
def __init__(self, cache_only=False, locker=None):
@@ -190,8 +209,7 @@ class RepoUpdateActionCommand(object):
self.manage_repos = 1
self.apply_overrides = apply_overrides
- if CFG.has_option('rhsm', 'manage_repos'):
- self.manage_repos = CFG.get_int('rhsm', 'manage_repos')
+ self.manage_repos = manage_repos_enabled()
self.release = None
self.overrides = {}
@@ -682,16 +700,14 @@ class RepoFile(ConfigParser):
# note PATH get's expanded with chroot info, etc
self.path = Path.join(self.PATH, name)
self.repos_dir = Path.abs(self.PATH)
- self.manage_repos = 1
- if CFG.has_option('rhsm', 'manage_repos'):
- self.manage_repos = CFG.get_int('rhsm', 'manage_repos')
+ self.manage_repos = manage_repos_enabled()
# 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.
if not self.path_exists(self.repos_dir):
log.warn("%s does not exist, turning manage_repos off." %
self.repos_dir)
- self.manage_repos = 0
+ self.manage_repos = False
self.create()
# Easier than trying to mock/patch os.path.exists
diff --git a/subscription-manager.spec b/subscription-manager.spec
index aaec788..24e6f4e 100644
--- a/subscription-manager.spec
+++ b/subscription-manager.spec
@@ -49,7 +49,7 @@
Name: subscription-manager
Version: 1.15.9
-Release: 14%{?dist}
+Release: 15%{?dist}
Summary: Tools and libraries for subscription and repository management
Group: System Environment/Base
License: GPLv2
@@ -542,6 +542,12 @@ fi
%endif
%changelog
+* Tue Oct 13 2015 Chris Rog <crog@redhat.com> 1.15.9-15
+- 1254460: Fixed the credits button in the about dialog in subman GUI
+ (crog@redhat.com)
+- 1251853: Fix errors if "manage_repos = " in cfg (alikins@redhat.com)
+- 1270204: Crash report no longer sent when widget is none (csnyder@redhat.com)
+
* Wed Oct 07 2015 Chris Rog <crog@redhat.com> 1.15.9-14
- 1268102: Stop main window from opening duplicate dialogs. (awood@redhat.com)
- 1268088: Changes the rhsm spoke display message to end with "registered"
diff --git a/test/test_managercli.py b/test/test_managercli.py
index 318dbc4..3c7ab60 100644
--- a/test/test_managercli.py
+++ b/test/test_managercli.py
@@ -8,6 +8,7 @@ import os
import tempfile
import contextlib
+
# for monkey patching config
import stubs
diff --git a/test/test_repolib.py b/test/test_repolib.py
index 70e1800..ad92967 100644
--- a/test/test_repolib.py
+++ b/test/test_repolib.py
@@ -17,7 +17,7 @@
import re
import unittest
-from iniparse import RawConfigParser
+from iniparse import RawConfigParser, SafeConfigParser
from mock import Mock, patch
from StringIO import StringIO
@@ -28,6 +28,7 @@ from stubs import StubCertificateDirectory, StubProductCertificate, \
from subscription_manager.repolib import Repo, RepoActionInvoker, \
RepoUpdateActionCommand, TidyWriter, RepoFile, YumReleaseverSource
from subscription_manager import injection as inj
+from rhsm import config
from subscription_manager import repolib
@@ -738,3 +739,86 @@ class RepoFileTest(unittest.TestCase):
rf.set('test', 'k', 1)
other.set('test', 'k', '1')
self.assertTrue(rf._configparsers_equal(other))
+
+
+# config file is root only, so just fill in a stringbuffer
+unset_manage_repos_cfg_buf = """
+[server]
+hostname = server.example.conf
+prefix = /candlepin
+[rhsm]
+manage_repos =
+
+[rhsmcertd]
+certCheckInterval = 240
+"""
+
+
+class RhsmConfigParserFromString(config.RhsmConfigParser):
+ def __init__(self, config_string):
+ SafeConfigParser.__init__(self)
+ self.stringio = StringIO(config_string)
+ self.readfp(self.stringio)
+
+
+unset_config = """[server]
+hostname = server.example.conf
+"""
+
+manage_repos_zero_config = """[rhsm]
+manage_repos = 0
+"""
+
+manage_repos_bool_config = """[rhsm]
+manage_repos = false
+"""
+
+manage_repos_not_an_int = """[rhsm]
+manage_repos = thisisanint
+"""
+
+manage_repos_int_37 = """[rhsm]
+manage_repos = 37
+"""
+
+
+class TestManageReposEnabled(fixture.SubManFixture):
+ @patch.object(repolib, 'CFG',
+ RhsmConfigParserFromString(config_string=unset_config))
+ def test(self):
+ # default stub config, no manage_repo defined, uses default
+ manage_repos_enabled = repolib.manage_repos_enabled()
+ self.assertEquals(manage_repos_enabled, True)
+
+ @patch.object(repolib, 'CFG',
+ RhsmConfigParserFromString(config_string=unset_manage_repos_cfg_buf))
+ def test_empty_manage_repos(self):
+ manage_repos_enabled = repolib.manage_repos_enabled()
+ self.assertEquals(manage_repos_enabled, True)
+
+ @patch.object(repolib, 'CFG',
+ RhsmConfigParserFromString(config_string=manage_repos_zero_config))
+ def test_empty_manage_repos_zero(self):
+ manage_repos_enabled = repolib.manage_repos_enabled()
+ self.assertEquals(manage_repos_enabled, False)
+
+ @patch.object(repolib, 'CFG',
+ RhsmConfigParserFromString(config_string=manage_repos_bool_config))
+ def test_empty_manage_repos_bool(self):
+ manage_repos_enabled = repolib.manage_repos_enabled()
+ # Should fail, and return default of 1
+ self.assertEquals(manage_repos_enabled, True)
+
+ @patch.object(repolib, 'CFG',
+ RhsmConfigParserFromString(config_string=manage_repos_not_an_int))
+ def test_empty_manage_repos_not_an_int(self):
+ manage_repos_enabled = repolib.manage_repos_enabled()
+ # Should fail, and return default of 1
+ self.assertEquals(manage_repos_enabled, True)
+
+ @patch.object(repolib, 'CFG',
+ RhsmConfigParserFromString(config_string=manage_repos_int_37))
+ def test_empty_manage_repos_int_37(self):
+ manage_repos_enabled = repolib.manage_repos_enabled()
+ # Should fail, and return default of 1
+ self.assertEquals(manage_repos_enabled, True)