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