|
|
2d607d |
diff --git a/Makefile b/Makefile
|
|
|
2d607d |
index f773ca4..f37573b 100644
|
|
|
2d607d |
--- a/Makefile
|
|
|
2d607d |
+++ b/Makefile
|
|
|
2d607d |
@@ -32,7 +32,7 @@ EXAMPLE_PLUGINS_SRC_DIR := example-plugins/
|
|
|
2d607d |
YUM_PLUGINS_SRC_DIR := $(BASE_SRC_DIR)/plugins
|
|
|
2d607d |
ALL_SRC_DIRS := $(SRC_DIR) $(RCT_SRC_DIR) $(RD_SRC_DIR) $(DAEMONS_SRC_DIR) $(EXAMPLE_PLUGINS_SRC_DIR) $(YUM_PLUGINS_SRC_DIR)
|
|
|
2d607d |
|
|
|
2d607d |
-CFLAGS = -Wall -g
|
|
|
2d607d |
+CFLAGS ?= -g -Wall
|
|
|
2d607d |
|
|
|
2d607d |
%.pyc: %.py
|
|
|
2d607d |
python -c "import py_compile; py_compile.compile('$<')"
|
|
|
2d607d |
diff --git a/etc-conf/rhsm-debug.completion.sh b/etc-conf/rhsm-debug.completion.sh
|
|
|
2d607d |
index 36483fb..14227f3 100644
|
|
|
2d607d |
--- a/etc-conf/rhsm-debug.completion.sh
|
|
|
2d607d |
+++ b/etc-conf/rhsm-debug.completion.sh
|
|
|
2d607d |
@@ -17,7 +17,7 @@ _rhsm-debug()
|
|
|
2d607d |
system)
|
|
|
2d607d |
case "${cur}" in
|
|
|
2d607d |
-*)
|
|
|
2d607d |
- local opts="--destination --no-archive ${_rhsm_debug_common_opts}"
|
|
|
2d607d |
+ local opts="--destination --no-archive --sos ${_rhsm_debug_common_opts}"
|
|
|
2d607d |
COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) )
|
|
|
2d607d |
return 0
|
|
|
2d607d |
;;
|
|
|
2d607d |
diff --git a/man/rhsm-debug.8 b/man/rhsm-debug.8
|
|
|
2d607d |
index ef2151f..74e69dc 100644
|
|
|
2d607d |
--- a/man/rhsm-debug.8
|
|
|
2d607d |
+++ b/man/rhsm-debug.8
|
|
|
2d607d |
@@ -55,6 +55,10 @@ The directory to place the resulting debug data. The default is /tmp.
|
|
|
2d607d |
.B --no-archive
|
|
|
2d607d |
Generates an uncompressed directory intead of a gzipped file.
|
|
|
2d607d |
|
|
|
2d607d |
+.TP
|
|
|
2d607d |
+.B --sos
|
|
|
2d607d |
+Eliminiates the information that has already been collected by the SOS report process.
|
|
|
2d607d |
+
|
|
|
2d607d |
|
|
|
2d607d |
.SH BUGS
|
|
|
2d607d |
This tool is part of Red Hat Subscription Manager. To file bugs against this command-line tool, go to <https://bugzilla.redhat.com>, and select Red Hat > Red Hat Enterprise Linux > subscription-manager.
|
|
|
2d607d |
diff --git a/rel-eng/packages/subscription-manager b/rel-eng/packages/subscription-manager
|
|
|
2d607d |
index b52ea0a..abf9a7a 100644
|
|
|
2d607d |
--- a/rel-eng/packages/subscription-manager
|
|
|
2d607d |
+++ b/rel-eng/packages/subscription-manager
|
|
|
2d607d |
@@ -1 +1 @@
|
|
|
2d607d |
-1.10.14-1 ./
|
|
|
2d607d |
+1.10.14-2 ./
|
|
|
2d607d |
diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf
|
|
|
2d607d |
index 5535100..fe97c99 100644
|
|
|
2d607d |
--- a/rel-eng/releasers.conf
|
|
|
2d607d |
+++ b/rel-eng/releasers.conf
|
|
|
2d607d |
@@ -1,56 +1,4 @@
|
|
|
2d607d |
-[yum-f19-x86_64]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = fedora-19-x86_64
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-19/x86_64/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-f19-i386]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = fedora-19-i386
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-19/i386/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-f18-x86_64]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = fedora-18-x86_64
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-18/x86_64/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-f18-i386]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = fedora-18-i386
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-18/i386/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-el6-x86_64]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = epel-6-x86_64
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6Server/x86_64/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6/x86_64/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-el6-i386]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = epel-6-i386
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6Server/i386/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6/i386/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-el5-x86_64]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = epel-5-x86_64
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5Server/x86_64/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5/x86_64/
|
|
|
2d607d |
-
|
|
|
2d607d |
-[yum-el5-i386]
|
|
|
2d607d |
-releaser = tito.release.YumRepoReleaser
|
|
|
2d607d |
-builder = tito.builder.MockBuilder
|
|
|
2d607d |
-builder.mock = epel-5-i386
|
|
|
2d607d |
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5Server/i386/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5/i386/
|
|
|
2d607d |
-
|
|
|
2d607d |
[rhel-7.0]
|
|
|
2d607d |
releaser = tito.release.DistGitReleaser
|
|
|
2d607d |
branches = rhel-7.0
|
|
|
2d607d |
|
|
|
2d607d |
-[fedora]
|
|
|
2d607d |
-releaser = tito.release.FedoraGitReleaser
|
|
|
2d607d |
-branches = master f20 f19
|
|
|
2d607d |
-
|
|
|
2d607d |
diff --git a/rel-eng/tito.props b/rel-eng/tito.props
|
|
|
2d607d |
index 7e29003..17792b0 100644
|
|
|
2d607d |
--- a/rel-eng/tito.props
|
|
|
2d607d |
+++ b/rel-eng/tito.props
|
|
|
2d607d |
@@ -1,8 +1,4 @@
|
|
|
2d607d |
[globalconfig]
|
|
|
2d607d |
-default_builder = tito.builder.Builder
|
|
|
2d607d |
-default_tagger = tito.tagger.VersionTagger
|
|
|
2d607d |
-
|
|
|
2d607d |
-[cvs]
|
|
|
2d607d |
-cvsroot = :gserver:cvs.devel.redhat.com:/cvs/dist
|
|
|
2d607d |
-branches = RHEL-6
|
|
|
2d607d |
+default_builder = tito.builder.UpstreamBuilder
|
|
|
2d607d |
+default_tagger = tito.tagger.ReleaseTagger
|
|
|
2d607d |
|
|
|
2d607d |
diff --git a/src/rhsm_debug/debug_commands.py b/src/rhsm_debug/debug_commands.py
|
|
|
2d607d |
index e56ce0d..22ef9ad 100644
|
|
|
2d607d |
--- a/src/rhsm_debug/debug_commands.py
|
|
|
2d607d |
+++ b/src/rhsm_debug/debug_commands.py
|
|
|
2d607d |
@@ -20,6 +20,7 @@ import shutil
|
|
|
2d607d |
import logging
|
|
|
2d607d |
import tarfile
|
|
|
2d607d |
from datetime import datetime
|
|
|
2d607d |
+from shutil import ignore_patterns
|
|
|
2d607d |
|
|
|
2d607d |
import subscription_manager.injection as inj
|
|
|
2d607d |
import subscription_manager.managercli as managercli
|
|
|
2d607d |
@@ -38,6 +39,7 @@ NOT_REGISTERED = _("This system is not yet registered. Try 'subscription-manager
|
|
|
2d607d |
|
|
|
2d607d |
ASSEMBLE_DIR = '/var/spool/rhsm/debug'
|
|
|
2d607d |
ROOT_READ_ONLY = 0600
|
|
|
2d607d |
+KEY_IGNORE_PATS = ['*key.pem']
|
|
|
2d607d |
|
|
|
2d607d |
|
|
|
2d607d |
class SystemCommand(CliCommand):
|
|
|
2d607d |
@@ -54,6 +56,9 @@ class SystemCommand(CliCommand):
|
|
|
2d607d |
self.parser.add_option("--no-archive", action='store_false',
|
|
|
2d607d |
default=True, dest="archive",
|
|
|
2d607d |
help=_("data will be in an uncompressed directory"))
|
|
|
2d607d |
+ self.parser.add_option("--sos", action='store_true',
|
|
|
2d607d |
+ default=False, dest="sos",
|
|
|
2d607d |
+ help=_("only data not already included in sos report will be collected"))
|
|
|
2d607d |
|
|
|
2d607d |
def _get_usage(self):
|
|
|
2d607d |
return _("%%prog %s [OPTIONS] ") % self.name
|
|
|
2d607d |
@@ -103,12 +108,18 @@ class SystemCommand(CliCommand):
|
|
|
2d607d |
self._get_version_info())
|
|
|
2d607d |
|
|
|
2d607d |
# FIXME: we need to anon proxy passwords?
|
|
|
2d607d |
- self._copy_directory('/etc/rhsm', content_path)
|
|
|
2d607d |
- self._copy_directory('/var/log/rhsm', content_path)
|
|
|
2d607d |
- self._copy_directory('/var/lib/rhsm', content_path)
|
|
|
2d607d |
- self._copy_directory(cfg.get('rhsm', 'productCertDir'), content_path)
|
|
|
2d607d |
- self._copy_directory(cfg.get('rhsm', 'entitlementCertDir'), content_path)
|
|
|
2d607d |
- self._copy_directory(cfg.get('rhsm', 'consumerCertDir'), content_path)
|
|
|
2d607d |
+ sos = self.options.sos
|
|
|
2d607d |
+ defaults = cfg.defaults()
|
|
|
2d607d |
+ if defaults['productcertdir'] != cfg.get('rhsm', 'productCertDir') or not sos:
|
|
|
2d607d |
+ self._copy_cert_directory(cfg.get('rhsm', 'productCertDir'), content_path)
|
|
|
2d607d |
+ if defaults['entitlementcertdir'] != cfg.get('rhsm', 'entitlementCertDir') or not sos:
|
|
|
2d607d |
+ self._copy_cert_directory(cfg.get('rhsm', 'entitlementCertDir'), content_path)
|
|
|
2d607d |
+ if defaults['consumercertdir'] != cfg.get('rhsm', 'consumerCertDir') or not sos:
|
|
|
2d607d |
+ self._copy_cert_directory(cfg.get('rhsm', 'consumerCertDir'), content_path)
|
|
|
2d607d |
+ if not sos:
|
|
|
2d607d |
+ self._copy_directory('/etc/rhsm', content_path)
|
|
|
2d607d |
+ self._copy_directory('/var/log/rhsm', content_path)
|
|
|
2d607d |
+ self._copy_directory('/var/lib/rhsm', content_path)
|
|
|
2d607d |
|
|
|
2d607d |
# build an archive by default
|
|
|
2d607d |
if self.options.archive:
|
|
|
2d607d |
@@ -158,11 +169,20 @@ class SystemCommand(CliCommand):
|
|
|
2d607d |
with open(path, "w+") as fo:
|
|
|
2d607d |
fo.write(json.dumps(content, indent=4, sort_keys=True))
|
|
|
2d607d |
|
|
|
2d607d |
- def _copy_directory(self, src_path, dest_path):
|
|
|
2d607d |
+ def _copy_directory(self, src_path, dest_path, ignore_pats=[]):
|
|
|
2d607d |
rel_path = src_path
|
|
|
2d607d |
if os.path.isabs(src_path):
|
|
|
2d607d |
rel_path = src_path[1:]
|
|
|
2d607d |
- shutil.copytree(src_path, os.path.join(dest_path, rel_path))
|
|
|
2d607d |
+ if ignore_pats is not None:
|
|
|
2d607d |
+ shutil.copytree(src_path, os.path.join(dest_path, rel_path),
|
|
|
2d607d |
+ ignore=ignore_patterns(*ignore_pats))
|
|
|
2d607d |
+ else:
|
|
|
2d607d |
+ shutil.copytree(src_path, os.path.join(dest_path, rel_path))
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def _copy_cert_directory(self, src_path, dest_path):
|
|
|
2d607d |
+ self._copy_directory(src_path,
|
|
|
2d607d |
+ dest_path,
|
|
|
2d607d |
+ KEY_IGNORE_PATS)
|
|
|
2d607d |
|
|
|
2d607d |
def _get_assemble_dir(self):
|
|
|
2d607d |
return ASSEMBLE_DIR
|
|
|
2d607d |
diff --git a/src/subscription_manager/gui/data/choose_server.glade b/src/subscription_manager/gui/data/choose_server.glade
|
|
|
2d607d |
index b913a42..15572a8 100644
|
|
|
2d607d |
--- a/src/subscription_manager/gui/data/choose_server.glade
|
|
|
2d607d |
+++ b/src/subscription_manager/gui/data/choose_server.glade
|
|
|
2d607d |
@@ -156,18 +156,19 @@
|
|
|
2d607d |
<widget class="GtkHBox" id="hbox3">
|
|
|
2d607d |
<property name="visible">True</property>
|
|
|
2d607d |
<property name="can_focus">False</property>
|
|
|
2d607d |
- <property name="spacing">25</property>
|
|
|
2d607d |
+ <property name="spacing">5</property>
|
|
|
2d607d |
<child>
|
|
|
2d607d |
<widget class="GtkCheckButton" id="activation_key_checkbox">
|
|
|
2d607d |
<property name="label" translatable="yes">I will use an Activation Key</property>
|
|
|
2d607d |
<property name="visible">True</property>
|
|
|
2d607d |
<property name="can_focus">True</property>
|
|
|
2d607d |
<property name="receives_default">False</property>
|
|
|
2d607d |
+ <property name="xalign">0</property>
|
|
|
2d607d |
<property name="draw_indicator">True</property>
|
|
|
2d607d |
</widget>
|
|
|
2d607d |
<packing>
|
|
|
2d607d |
- <property name="expand">True</property>
|
|
|
2d607d |
- <property name="fill">True</property>
|
|
|
2d607d |
+ <property name="expand">False</property>
|
|
|
2d607d |
+ <property name="fill">False</property>
|
|
|
2d607d |
<property name="position">0</property>
|
|
|
2d607d |
</packing>
|
|
|
2d607d |
</child>
|
|
|
2d607d |
@@ -175,7 +176,8 @@
|
|
|
2d607d |
<widget class="GtkAlignment" id="alignment3">
|
|
|
2d607d |
<property name="visible">True</property>
|
|
|
2d607d |
<property name="can_focus">False</property>
|
|
|
2d607d |
- <property name="right_padding">16</property>
|
|
|
2d607d |
+ <property name="xalign">0</property>
|
|
|
2d607d |
+ <property name="left_padding">5</property>
|
|
|
2d607d |
<child>
|
|
|
2d607d |
<widget class="GtkImage" id="image3">
|
|
|
2d607d |
<property name="visible">True</property>
|
|
|
2d607d |
@@ -187,7 +189,7 @@
|
|
|
2d607d |
</child>
|
|
|
2d607d |
</widget>
|
|
|
2d607d |
<packing>
|
|
|
2d607d |
- <property name="expand">True</property>
|
|
|
2d607d |
+ <property name="expand">False</property>
|
|
|
2d607d |
<property name="fill">False</property>
|
|
|
2d607d |
<property name="position">1</property>
|
|
|
2d607d |
</packing>
|
|
|
2d607d |
@@ -198,7 +200,6 @@
|
|
|
2d607d |
<property name="right_attach">2</property>
|
|
|
2d607d |
<property name="top_attach">1</property>
|
|
|
2d607d |
<property name="bottom_attach">2</property>
|
|
|
2d607d |
- <property name="x_options">GTK_EXPAND</property>
|
|
|
2d607d |
</packing>
|
|
|
2d607d |
</child>
|
|
|
2d607d |
</widget>
|
|
|
2d607d |
diff --git a/src/subscription_manager/productid.py b/src/subscription_manager/productid.py
|
|
|
2d607d |
index 4c3cdf2..698f5d2 100644
|
|
|
2d607d |
--- a/src/subscription_manager/productid.py
|
|
|
2d607d |
+++ b/src/subscription_manager/productid.py
|
|
|
2d607d |
@@ -19,7 +19,6 @@ import gettext
|
|
|
2d607d |
from gzip import GzipFile
|
|
|
2d607d |
import logging
|
|
|
2d607d |
import os
|
|
|
2d607d |
-import re
|
|
|
2d607d |
import types
|
|
|
2d607d |
import yum
|
|
|
2d607d |
|
|
|
2d607d |
@@ -27,6 +26,7 @@ from rhsm.certificate import create_from_pem
|
|
|
2d607d |
|
|
|
2d607d |
from subscription_manager.certdirectory import Directory
|
|
|
2d607d |
from subscription_manager.injection import PLUGIN_MANAGER, require
|
|
|
2d607d |
+from subscription_manager import rhelproduct
|
|
|
2d607d |
import subscription_manager.injection as inj
|
|
|
2d607d |
from rhsm import ourjson as json
|
|
|
2d607d |
|
|
|
2d607d |
@@ -101,23 +101,6 @@ class ProductDatabase:
|
|
|
2d607d |
return self.dir.abspath('productid.js')
|
|
|
2d607d |
|
|
|
2d607d |
|
|
|
2d607d |
-class RHELProductMatcher(object):
|
|
|
2d607d |
- def __init__(self, product=None):
|
|
|
2d607d |
- self.product = product
|
|
|
2d607d |
- # Match "rhel-6" or "rhel-11"
|
|
|
2d607d |
- # but not "rhel-6-server" or "rhel-6-server-highavailabilty"
|
|
|
2d607d |
- self.pattern = "rhel-\d+$"
|
|
|
2d607d |
-
|
|
|
2d607d |
- def is_rhel(self):
|
|
|
2d607d |
- """return true if this is a rhel product cert"""
|
|
|
2d607d |
-
|
|
|
2d607d |
- for tag in self.product.provided_tags:
|
|
|
2d607d |
- if re.match(self.pattern, tag):
|
|
|
2d607d |
- return True
|
|
|
2d607d |
-
|
|
|
2d607d |
- return False
|
|
|
2d607d |
-
|
|
|
2d607d |
-
|
|
|
2d607d |
class ProductManager:
|
|
|
2d607d |
"""Manager product certs, detecting when they need to be installed, or deleted.
|
|
|
2d607d |
|
|
|
2d607d |
@@ -395,7 +378,7 @@ class ProductManager:
|
|
|
2d607d |
# is not 'active'. So it ends up deleting the product cert for rhel since
|
|
|
2d607d |
# it appears it is not being used. It is kind of a strange case for the
|
|
|
2d607d |
# base os product cert, so we hardcode a special case here.
|
|
|
2d607d |
- rhel_matcher = RHELProductMatcher(p)
|
|
|
2d607d |
+ rhel_matcher = rhelproduct.RHELProductMatcher(p)
|
|
|
2d607d |
if rhel_matcher.is_rhel():
|
|
|
2d607d |
delete_product_cert = False
|
|
|
2d607d |
|
|
|
2d607d |
diff --git a/src/subscription_manager/release.py b/src/subscription_manager/release.py
|
|
|
2d607d |
index 228b261..4b4fb9d 100644
|
|
|
2d607d |
--- a/src/subscription_manager/release.py
|
|
|
2d607d |
+++ b/src/subscription_manager/release.py
|
|
|
2d607d |
@@ -27,6 +27,7 @@ import rhsm.config
|
|
|
2d607d |
|
|
|
2d607d |
from subscription_manager.facts import Facts
|
|
|
2d607d |
from subscription_manager import listing
|
|
|
2d607d |
+from subscription_manager import rhelproduct
|
|
|
2d607d |
|
|
|
2d607d |
_ = gettext.gettext
|
|
|
2d607d |
|
|
|
2d607d |
@@ -55,21 +56,21 @@ class ReleaseBackend(object):
|
|
|
2d607d |
prod_dir=self.product_dir)
|
|
|
2d607d |
|
|
|
2d607d |
# find the rhel product
|
|
|
2d607d |
- rhel_product = None
|
|
|
2d607d |
+ release_product = None
|
|
|
2d607d |
installed_products = self.product_dir.get_installed_products()
|
|
|
2d607d |
for product_hash in installed_products:
|
|
|
2d607d |
product_cert = installed_products[product_hash]
|
|
|
2d607d |
products = product_cert.products
|
|
|
2d607d |
for product in products:
|
|
|
2d607d |
- product_tags = product.provided_tags
|
|
|
2d607d |
+ rhel_matcher = rhelproduct.RHELProductMatcher(product)
|
|
|
2d607d |
+ if rhel_matcher.is_rhel():
|
|
|
2d607d |
+ release_product = product
|
|
|
2d607d |
|
|
|
2d607d |
- if self._is_rhel(product_tags):
|
|
|
2d607d |
- rhel_product = product
|
|
|
2d607d |
-
|
|
|
2d607d |
- if rhel_product is None:
|
|
|
2d607d |
+ if release_product is None:
|
|
|
2d607d |
+ log.info("No products with RHEL product tags found")
|
|
|
2d607d |
return []
|
|
|
2d607d |
|
|
|
2d607d |
- entitlements = self.entitlement_dir.list_for_product(rhel_product.id)
|
|
|
2d607d |
+ entitlements = self.entitlement_dir.list_for_product(release_product.id)
|
|
|
2d607d |
listings = []
|
|
|
2d607d |
for entitlement in entitlements:
|
|
|
2d607d |
contents = entitlement.content
|
|
|
2d607d |
@@ -78,7 +79,7 @@ class ReleaseBackend(object):
|
|
|
2d607d |
# see bz #820639
|
|
|
2d607d |
if not content.enabled:
|
|
|
2d607d |
continue
|
|
|
2d607d |
- if self._is_correct_rhel(rhel_product.provided_tags,
|
|
|
2d607d |
+ if self._is_correct_rhel(release_product.provided_tags,
|
|
|
2d607d |
content.required_tags):
|
|
|
2d607d |
listing_path = self._build_listing_path(content.url)
|
|
|
2d607d |
listings.append(listing_path)
|
|
|
2d607d |
@@ -125,22 +126,8 @@ class ReleaseBackend(object):
|
|
|
2d607d |
# FIXME: cleanup paths ("//"'s, etc)
|
|
|
2d607d |
return listing_path
|
|
|
2d607d |
|
|
|
2d607d |
- def _is_rhel(self, product_tags):
|
|
|
2d607d |
- #easy to pass a string instead of a list
|
|
|
2d607d |
- assert not isinstance(product_tags, basestring)
|
|
|
2d607d |
-
|
|
|
2d607d |
- for product_tag in product_tags:
|
|
|
2d607d |
- # so in theory, we should only have one rhel
|
|
|
2d607d |
- # product. Not sure what to do if we have
|
|
|
2d607d |
- # more than one. Probably throw an error
|
|
|
2d607d |
- # TESTME
|
|
|
2d607d |
- if product_tag.split('-', 1)[0] == "rhel":
|
|
|
2d607d |
- # we only need to match the first hit
|
|
|
2d607d |
- return True
|
|
|
2d607d |
- log.info("No products with RHEL product tags found")
|
|
|
2d607d |
- return False
|
|
|
2d607d |
-
|
|
|
2d607d |
# require tags provided by installed products?
|
|
|
2d607d |
+
|
|
|
2d607d |
def _is_correct_rhel(self, product_tags, content_tags):
|
|
|
2d607d |
# easy to pass a string instead of a list
|
|
|
2d607d |
assert not isinstance(product_tags, basestring)
|
|
|
2d607d |
diff --git a/src/subscription_manager/rhelproduct.py b/src/subscription_manager/rhelproduct.py
|
|
|
2d607d |
new file mode 100644
|
|
|
2d607d |
index 0000000..64192a6
|
|
|
2d607d |
--- /dev/null
|
|
|
2d607d |
+++ b/src/subscription_manager/rhelproduct.py
|
|
|
2d607d |
@@ -0,0 +1,43 @@
|
|
|
2d607d |
+#
|
|
|
2d607d |
+# Copyright (c) 2014 Red Hat, Inc.
|
|
|
2d607d |
+#
|
|
|
2d607d |
+# This software is licensed to you under the GNU General Public License,
|
|
|
2d607d |
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
|
|
|
2d607d |
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
|
|
|
2d607d |
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
|
|
|
2d607d |
+# along with this software; if not, see
|
|
|
2d607d |
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
|
|
2d607d |
+#
|
|
|
2d607d |
+# Red Hat trademarks are not licensed under GPLv2. No permission is
|
|
|
2d607d |
+# granted to use or replicate Red Hat trademarks that are incorporated
|
|
|
2d607d |
+# in this software or its documentation.
|
|
|
2d607d |
+#
|
|
|
2d607d |
+#
|
|
|
2d607d |
+# RHEL product specific code
|
|
|
2d607d |
+#
|
|
|
2d607d |
+
|
|
|
2d607d |
+import re
|
|
|
2d607d |
+
|
|
|
2d607d |
+
|
|
|
2d607d |
+# NOTE: This class compares a Product that could be from a ProductCertificate
|
|
|
2d607d |
+# or from an Entitlement. Product's from Entitlements may include a
|
|
|
2d607d |
+# brand_type attribute. A Product that represents a RHEL base os
|
|
|
2d607d |
+# may or may not be a RHEL "branded" Product. See rhelentbranding for
|
|
|
2d607d |
+# code that handles finding and comparing RHEL "branded" Product objects.
|
|
|
2d607d |
+#
|
|
|
2d607d |
+class RHELProductMatcher(object):
|
|
|
2d607d |
+ """Check a Product object to see if it is a RHEL product.
|
|
|
2d607d |
+
|
|
|
2d607d |
+ Compares the provided tags to see if any provide 'rhel-VERSION'.
|
|
|
2d607d |
+ """
|
|
|
2d607d |
+ def __init__(self, product=None):
|
|
|
2d607d |
+ self.product = product
|
|
|
2d607d |
+ # Match "rhel-6" or "rhel-11"
|
|
|
2d607d |
+ # but not "rhel-6-server" or "rhel-6-server-highavailabilty"
|
|
|
2d607d |
+ self.pattern = "rhel-\d+$"
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def is_rhel(self):
|
|
|
2d607d |
+ """return true if this is a rhel product cert"""
|
|
|
2d607d |
+
|
|
|
2d607d |
+ return any([re.match(self.pattern, tag)
|
|
|
2d607d |
+ for tag in self.product.provided_tags])
|
|
|
2d607d |
diff --git a/subscription-manager.spec b/subscription-manager.spec
|
|
|
2d607d |
index 1fdb3c3..02eaafb 100644
|
|
|
2d607d |
--- a/subscription-manager.spec
|
|
|
2d607d |
+++ b/subscription-manager.spec
|
|
|
2d607d |
@@ -6,6 +6,9 @@
|
|
|
2d607d |
|
|
|
2d607d |
%define rhsm_plugins_dir /usr/share/rhsm-plugins
|
|
|
2d607d |
|
|
|
2d607d |
+
|
|
|
2d607d |
+%global _hardened_build 1
|
|
|
2d607d |
+
|
|
|
2d607d |
# A couple files are for RHEL 5 only:
|
|
|
2d607d |
%if 0%{?rhel} == 5
|
|
|
2d607d |
%define el5 1
|
|
|
2d607d |
@@ -13,7 +16,7 @@
|
|
|
2d607d |
|
|
|
2d607d |
Name: subscription-manager
|
|
|
2d607d |
Version: 1.10.14
|
|
|
2d607d |
-Release: 1%{?dist}
|
|
|
2d607d |
+Release: 2%{?dist}
|
|
|
2d607d |
Summary: Tools and libraries for subscription and repository management
|
|
|
2d607d |
Group: System Environment/Base
|
|
|
2d607d |
License: GPLv2
|
|
|
2d607d |
@@ -140,7 +143,7 @@ subscriptions
|
|
|
2d607d |
%setup -q
|
|
|
2d607d |
|
|
|
2d607d |
%build
|
|
|
2d607d |
-make -f Makefile
|
|
|
2d607d |
+make -f Makefile CFLAGS="%{optflags}"
|
|
|
2d607d |
|
|
|
2d607d |
%install
|
|
|
2d607d |
rm -rf %{buildroot}
|
|
|
2d607d |
@@ -246,6 +249,7 @@ rm -rf %{buildroot}
|
|
|
2d607d |
%{_datadir}/rhsm/subscription_manager/release.py*
|
|
|
2d607d |
%{_datadir}/rhsm/subscription_manager/repolib.py*
|
|
|
2d607d |
%{_datadir}/rhsm/subscription_manager/rhelentbranding.py*
|
|
|
2d607d |
+%{_datadir}/rhsm/subscription_manager/rhelproduct.py*
|
|
|
2d607d |
%{_datadir}/rhsm/subscription_manager/utils.py*
|
|
|
2d607d |
%{_datadir}/rhsm/subscription_manager/printing_utils.py*
|
|
|
2d607d |
%{_datadir}/rhsm/subscription_manager/validity.py*
|
|
|
2d607d |
@@ -418,6 +422,14 @@ fi
|
|
|
2d607d |
%endif
|
|
|
2d607d |
|
|
|
2d607d |
%changelog
|
|
|
2d607d |
+* Tue Feb 18 2014 ckozak <ckozak@redhat.com> 1.10.14-2
|
|
|
2d607d |
+- updated tito.props to rev release (ckozak@redhat.com)
|
|
|
2d607d |
+- 958016: use rpm %%{optflags} and _hardended_build (alikins@redhat.com)
|
|
|
2d607d |
+- 851325: Tweak activation key checkbox to left (alikins@redhat.com)
|
|
|
2d607d |
+- 1044596: Don't match beta product tags for release (alikins@redhat.com)
|
|
|
2d607d |
+- 1060727: Changes to rhsm-debug for sos report (wpoteat@redhat.com)
|
|
|
2d607d |
+- removed other releasers (ckozak@redhat.com)
|
|
|
2d607d |
+
|
|
|
2d607d |
* Tue Feb 11 2014 ckozak <ckozak@redhat.com> 1.10.14-1
|
|
|
2d607d |
- Use glob for finding entitlement certs to remove. (dgoodwin@redhat.com)
|
|
|
2d607d |
- Make sure entitlement cert directory exists before we clean it out.
|
|
|
2d607d |
diff --git a/test/test_productid.py b/test/test_productid.py
|
|
|
2d607d |
index f1e6162..fbac60b 100644
|
|
|
2d607d |
--- a/test/test_productid.py
|
|
|
2d607d |
+++ b/test/test_productid.py
|
|
|
2d607d |
@@ -151,81 +151,6 @@ class TestProductDatabase(unittest.TestCase):
|
|
|
2d607d |
self.assertEquals(len_content, len_content2)
|
|
|
2d607d |
|
|
|
2d607d |
|
|
|
2d607d |
-# matches:
|
|
|
2d607d |
-# rhel-6
|
|
|
2d607d |
-# not matches
|
|
|
2d607d |
-# rhel-6-server-highavailibity
|
|
|
2d607d |
-# rhel-6-computenode-hpn
|
|
|
2d607d |
-# rhel-6-hpn
|
|
|
2d607d |
-# rhel-6-server-resilientstorage
|
|
|
2d607d |
-# rhel-6-resilientstorage
|
|
|
2d607d |
-class TestRHELProductMatcher(SubManFixture):
|
|
|
2d607d |
-
|
|
|
2d607d |
- matches = ["rhel-6,rhel-6-client",
|
|
|
2d607d |
- "rhel-6,rhel-6-client",
|
|
|
2d607d |
- "rhel-6,rhel-6-computenode",
|
|
|
2d607d |
- "rhel-6,rhel-6-server",
|
|
|
2d607d |
- "rhel-6,rhel-6-ibm-power",
|
|
|
2d607d |
- "rhel-6,rhel-6-ibm-system-z",
|
|
|
2d607d |
- "rhel-6,rhel-6-server",
|
|
|
2d607d |
- "rhel-6,rhel-6-workstation",
|
|
|
2d607d |
- "rhel-6,rhel-6-workstation",
|
|
|
2d607d |
- "rhel-11",
|
|
|
2d607d |
- "rhel-6,rhel-6-someotherthing",
|
|
|
2d607d |
- "rhel-11,rhel-11-something"]
|
|
|
2d607d |
-
|
|
|
2d607d |
- not_matches = ["rhel-5-server-scalablefilesystem,rhel-5-scalablefilesystem",
|
|
|
2d607d |
- "rhel-5-server-clusterstorage,rhel-5-clusterstorage",
|
|
|
2d607d |
- "rhel-6-server-highavailibity",
|
|
|
2d607d |
- "rhel-6-server-loadbalancer,rhel-6-loadbalancer",
|
|
|
2d607d |
- "rhel-6-ibm-system-z",
|
|
|
2d607d |
- "rhel-somethingelse",
|
|
|
2d607d |
- "rhel",
|
|
|
2d607d |
- "rhel-rhel-rhelly-rhel",
|
|
|
2d607d |
- "rhel-",
|
|
|
2d607d |
- "rhev-3",
|
|
|
2d607d |
- "what-is-this-rhel-6",
|
|
|
2d607d |
- "not-rhel-6",
|
|
|
2d607d |
- "stillnotrhel-6",
|
|
|
2d607d |
- "rhel-6-rhel-6",
|
|
|
2d607d |
- "el-6",
|
|
|
2d607d |
- "rhel-6.1",
|
|
|
2d607d |
- "rhel-11-but-this-rhel-goes-to-11",
|
|
|
2d607d |
- "rhel-11.11",
|
|
|
2d607d |
- "fedora-20",
|
|
|
2d607d |
- "awsomeos-11",
|
|
|
2d607d |
- "6"]
|
|
|
2d607d |
-
|
|
|
2d607d |
- def test_matches(self):
|
|
|
2d607d |
- for tag in self.matches:
|
|
|
2d607d |
- self._assert_is_rhel(tag)
|
|
|
2d607d |
-
|
|
|
2d607d |
- def test_not_matches(self):
|
|
|
2d607d |
- for tag in self.not_matches:
|
|
|
2d607d |
- self._assert_is_not_rhel(tag)
|
|
|
2d607d |
-
|
|
|
2d607d |
- def _assert_is_rhel(self, tags):
|
|
|
2d607d |
- matcher = self._build_matcher(tags)
|
|
|
2d607d |
- is_rhel = matcher.is_rhel()
|
|
|
2d607d |
- if not is_rhel:
|
|
|
2d607d |
- self.fail("RHELProductMatcher fail: %s is a rhel product tag but matcher failed" % tags)
|
|
|
2d607d |
-
|
|
|
2d607d |
- def _assert_is_not_rhel(self, tags):
|
|
|
2d607d |
- matcher = self._build_matcher(tags)
|
|
|
2d607d |
- is_rhel = matcher.is_rhel()
|
|
|
2d607d |
- if is_rhel:
|
|
|
2d607d |
- self.fail("RHELProductMatcher fail: %s is NOT a rhel product tag but matcher did not fail" % tags)
|
|
|
2d607d |
-
|
|
|
2d607d |
- def _build_matcher(self, tags):
|
|
|
2d607d |
- # NOTE: Matcher only looks at tags atm
|
|
|
2d607d |
- product = stubs.StubProduct("69", "Red Hat Enterprise Linux Server",
|
|
|
2d607d |
- version="6.2",
|
|
|
2d607d |
- provided_tags=tags)
|
|
|
2d607d |
-
|
|
|
2d607d |
- matcher = productid.RHELProductMatcher(product)
|
|
|
2d607d |
- return matcher
|
|
|
2d607d |
-
|
|
|
2d607d |
-
|
|
|
2d607d |
class TestProductManager(SubManFixture):
|
|
|
2d607d |
|
|
|
2d607d |
def setUp(self):
|
|
|
2d607d |
diff --git a/test/test_release.py b/test/test_release.py
|
|
|
2d607d |
index 0775f98..1d7e2d0 100644
|
|
|
2d607d |
--- a/test/test_release.py
|
|
|
2d607d |
+++ b/test/test_release.py
|
|
|
2d607d |
@@ -56,26 +56,70 @@ class TestReleaseBackend(fixture.SubManFixture):
|
|
|
2d607d |
stub_product = stubs.StubProduct("rhel-6")
|
|
|
2d607d |
stub_entitlement_certs = [stubs.StubEntitlementCertificate(stub_product,
|
|
|
2d607d |
content=stub_contents)]
|
|
|
2d607d |
- stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
|
|
|
2d607d |
+ self.stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
|
|
|
2d607d |
|
|
|
2d607d |
- stub_product_dir = stubs.StubProductDirectory(
|
|
|
2d607d |
+ self.stub_product_dir = stubs.StubProductDirectory(
|
|
|
2d607d |
[stubs.StubProductCertificate(
|
|
|
2d607d |
stubs.StubProduct("rhel-6",
|
|
|
2d607d |
- provided_tags="rhel-6-stub"),)])
|
|
|
2d607d |
+ provided_tags="rhel-6,rhel-6-stub"),)])
|
|
|
2d607d |
|
|
|
2d607d |
def get_versions(dummy):
|
|
|
2d607d |
return versions
|
|
|
2d607d |
- stub_content_connection = stubs.StubContentConnection()
|
|
|
2d607d |
- stub_content_connection.get_versions = get_versions
|
|
|
2d607d |
+ self.stub_content_connection = stubs.StubContentConnection()
|
|
|
2d607d |
+ self.stub_content_connection.get_versions = get_versions
|
|
|
2d607d |
|
|
|
2d607d |
- self.rb = release.ReleaseBackend(ent_dir=stub_entitlement_dir,
|
|
|
2d607d |
- prod_dir=stub_product_dir,
|
|
|
2d607d |
- content_connection=stub_content_connection)
|
|
|
2d607d |
+ self.rb = release.ReleaseBackend(ent_dir=self.stub_entitlement_dir,
|
|
|
2d607d |
+ prod_dir=self.stub_product_dir,
|
|
|
2d607d |
+ content_connection=self.stub_content_connection)
|
|
|
2d607d |
|
|
|
2d607d |
def test_get_releases(self):
|
|
|
2d607d |
releases = self.rb.get_releases()
|
|
|
2d607d |
self.assertNotEquals([], releases)
|
|
|
2d607d |
|
|
|
2d607d |
+ def test_get_releases_no_rhel(self):
|
|
|
2d607d |
+ stub_product_dir = stubs.StubProductDirectory(
|
|
|
2d607d |
+ [stubs.StubProductCertificate(
|
|
|
2d607d |
+ stubs.StubProduct("rhel-6-something",
|
|
|
2d607d |
+ provided_tags="rhel-6-something,rhel-6-stub"),)])
|
|
|
2d607d |
+
|
|
|
2d607d |
+ self.rb = release.ReleaseBackend(ent_dir=self.stub_entitlement_dir,
|
|
|
2d607d |
+ prod_dir=stub_product_dir,
|
|
|
2d607d |
+ content_connection=self.stub_content_connection)
|
|
|
2d607d |
+ releases = self.rb.get_releases()
|
|
|
2d607d |
+ self.assertEquals([], releases)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def test_get_releases_rhel_no_content(self):
|
|
|
2d607d |
+
|
|
|
2d607d |
+ stub_content_5 = stubs.StubContent("c5", required_tags="AwesomeOS",
|
|
|
2d607d |
+ gpg=None, enabled="1")
|
|
|
2d607d |
+
|
|
|
2d607d |
+ stub_product = stubs.StubProduct("rhel-6")
|
|
|
2d607d |
+ stub_entitlement_certs = [stubs.StubEntitlementCertificate(stub_product,
|
|
|
2d607d |
+ content=[stub_content_5])]
|
|
|
2d607d |
+
|
|
|
2d607d |
+ stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
|
|
|
2d607d |
+ self.rb = release.ReleaseBackend(ent_dir=stub_entitlement_dir,
|
|
|
2d607d |
+ prod_dir=self.stub_product_dir,
|
|
|
2d607d |
+ content_connection=self.stub_content_connection)
|
|
|
2d607d |
+ releases = self.rb.get_releases()
|
|
|
2d607d |
+ self.assertEquals([], releases)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def test_get_releases_rhel_no_enabled_content(self):
|
|
|
2d607d |
+
|
|
|
2d607d |
+ stub_content_6 = stubs.StubContent("c6", required_tags="rhel-6",
|
|
|
2d607d |
+ gpg=None, enabled="0")
|
|
|
2d607d |
+
|
|
|
2d607d |
+ stub_product = stubs.StubProduct("rhel-6")
|
|
|
2d607d |
+ stub_entitlement_certs = [stubs.StubEntitlementCertificate(stub_product,
|
|
|
2d607d |
+ content=[stub_content_6])]
|
|
|
2d607d |
+
|
|
|
2d607d |
+ stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
|
|
|
2d607d |
+ self.rb = release.ReleaseBackend(ent_dir=stub_entitlement_dir,
|
|
|
2d607d |
+ prod_dir=self.stub_product_dir,
|
|
|
2d607d |
+ content_connection=self.stub_content_connection)
|
|
|
2d607d |
+ releases = self.rb.get_releases()
|
|
|
2d607d |
+ self.assertEquals([], releases)
|
|
|
2d607d |
+
|
|
|
2d607d |
def test_get_releases_throws_exception(self):
|
|
|
2d607d |
with mock.patch.object(self.rb, 'content_connection') as mock_cc:
|
|
|
2d607d |
mock_cc.get_versions.side_effect = \
|
|
|
2d607d |
@@ -93,14 +137,6 @@ class TestReleaseBackend(fixture.SubManFixture):
|
|
|
2d607d |
releases = self.rb.get_releases()
|
|
|
2d607d |
self.assertEquals([], releases)
|
|
|
2d607d |
|
|
|
2d607d |
- def test_is_rhel(self):
|
|
|
2d607d |
- ir = self.rb._is_rhel(["rhel-6-test"])
|
|
|
2d607d |
- self.assertTrue(ir)
|
|
|
2d607d |
-
|
|
|
2d607d |
- def test_is_not_rhel(self):
|
|
|
2d607d |
- ir = self.rb._is_rhel(["awesome-test"])
|
|
|
2d607d |
- self.assertFalse(ir)
|
|
|
2d607d |
-
|
|
|
2d607d |
def test_is_correct_rhel(self):
|
|
|
2d607d |
icr = self.rb._is_correct_rhel(["rhel-6-test"], ["rhel-6"])
|
|
|
2d607d |
self.assertTrue(icr)
|
|
|
2d607d |
diff --git a/test/test_rhelproduct.py b/test/test_rhelproduct.py
|
|
|
2d607d |
new file mode 100644
|
|
|
2d607d |
index 0000000..db8049a
|
|
|
2d607d |
--- /dev/null
|
|
|
2d607d |
+++ b/test/test_rhelproduct.py
|
|
|
2d607d |
@@ -0,0 +1,81 @@
|
|
|
2d607d |
+
|
|
|
2d607d |
+import stubs
|
|
|
2d607d |
+
|
|
|
2d607d |
+from subscription_manager import rhelproduct
|
|
|
2d607d |
+
|
|
|
2d607d |
+from fixture import SubManFixture
|
|
|
2d607d |
+
|
|
|
2d607d |
+
|
|
|
2d607d |
+# matches:
|
|
|
2d607d |
+# rhel-6
|
|
|
2d607d |
+# not matches
|
|
|
2d607d |
+# rhel-6-server-highavailibity
|
|
|
2d607d |
+# rhel-6-computenode-hpn
|
|
|
2d607d |
+# rhel-6-hpn
|
|
|
2d607d |
+# rhel-6-server-resilientstorage
|
|
|
2d607d |
+# rhel-6-resilientstorage
|
|
|
2d607d |
+class TestRHELProductMatcher(SubManFixture):
|
|
|
2d607d |
+
|
|
|
2d607d |
+ matches = ["rhel-6,rhel-6-client",
|
|
|
2d607d |
+ "rhel-6,rhel-6-client",
|
|
|
2d607d |
+ "rhel-6,rhel-6-computenode",
|
|
|
2d607d |
+ "rhel-6,rhel-6-server",
|
|
|
2d607d |
+ "rhel-6,rhel-6-ibm-power",
|
|
|
2d607d |
+ "rhel-6,rhel-6-ibm-system-z",
|
|
|
2d607d |
+ "rhel-6,rhel-6-server",
|
|
|
2d607d |
+ "rhel-6,rhel-6-workstation",
|
|
|
2d607d |
+ "rhel-6,rhel-6-workstation",
|
|
|
2d607d |
+ "rhel-11",
|
|
|
2d607d |
+ "rhel-6,rhel-6-someotherthing",
|
|
|
2d607d |
+ "rhel-11,rhel-11-something"]
|
|
|
2d607d |
+
|
|
|
2d607d |
+ not_matches = ["rhel-5-server-scalablefilesystem,rhel-5-scalablefilesystem",
|
|
|
2d607d |
+ "rhel-5-server-clusterstorage,rhel-5-clusterstorage",
|
|
|
2d607d |
+ "rhel-6-server-highavailibity",
|
|
|
2d607d |
+ "rhel-6-server-loadbalancer,rhel-6-loadbalancer",
|
|
|
2d607d |
+ "rhel-6-ibm-system-z",
|
|
|
2d607d |
+ "rhel-somethingelse",
|
|
|
2d607d |
+ "rhel",
|
|
|
2d607d |
+ "rhel-rhel-rhelly-rhel",
|
|
|
2d607d |
+ "rhel-",
|
|
|
2d607d |
+ "rhev-3",
|
|
|
2d607d |
+ "what-is-this-rhel-6",
|
|
|
2d607d |
+ "not-rhel-6",
|
|
|
2d607d |
+ "stillnotrhel-6",
|
|
|
2d607d |
+ "rhel-6-rhel-6",
|
|
|
2d607d |
+ "el-6",
|
|
|
2d607d |
+ "rhel-6.1",
|
|
|
2d607d |
+ "rhel-11-but-this-rhel-goes-to-11",
|
|
|
2d607d |
+ "rhel-11.11",
|
|
|
2d607d |
+ "fedora-20",
|
|
|
2d607d |
+ "awsomeos-11",
|
|
|
2d607d |
+ "6"]
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def test_matches(self):
|
|
|
2d607d |
+ for tag in self.matches:
|
|
|
2d607d |
+ self._assert_is_rhel(tag)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def test_not_matches(self):
|
|
|
2d607d |
+ for tag in self.not_matches:
|
|
|
2d607d |
+ self._assert_is_not_rhel(tag)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def _assert_is_rhel(self, tags):
|
|
|
2d607d |
+ matcher = self._build_matcher(tags)
|
|
|
2d607d |
+ is_rhel = matcher.is_rhel()
|
|
|
2d607d |
+ if not is_rhel:
|
|
|
2d607d |
+ self.fail("RHELProductMatcher fail: %s is a rhel product tag but matcher failed" % tags)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def _assert_is_not_rhel(self, tags):
|
|
|
2d607d |
+ matcher = self._build_matcher(tags)
|
|
|
2d607d |
+ is_rhel = matcher.is_rhel()
|
|
|
2d607d |
+ if is_rhel:
|
|
|
2d607d |
+ self.fail("RHELProductMatcher fail: %s is NOT a rhel product tag but matcher did not fail" % tags)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ def _build_matcher(self, tags):
|
|
|
2d607d |
+ # NOTE: Matcher only looks at tags atm
|
|
|
2d607d |
+ product = stubs.StubProduct("69", "Red Hat Enterprise Linux Server",
|
|
|
2d607d |
+ version="6.2",
|
|
|
2d607d |
+ provided_tags=tags)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ matcher = rhelproduct.RHELProductMatcher(product)
|
|
|
2d607d |
+ return matcher
|
|
|
2d607d |
diff --git a/test/test_rhsm_debug_command.py b/test/test_rhsm_debug_command.py
|
|
|
2d607d |
index 280a674..cd762e3 100644
|
|
|
2d607d |
--- a/test/test_rhsm_debug_command.py
|
|
|
2d607d |
+++ b/test/test_rhsm_debug_command.py
|
|
|
2d607d |
@@ -66,21 +66,23 @@ class TestCompileCommand(TestCliCommand):
|
|
|
2d607d |
except SystemExit:
|
|
|
2d607d |
self.fail("Exception Raised")
|
|
|
2d607d |
|
|
|
2d607d |
- tar_path = path_join(path, "rhsm-debug-system-%s.tar.gz" % self.time_code)
|
|
|
2d607d |
- tar_file = tarfile.open(tar_path, "r")
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "consumer.json")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "compliance.json")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "entitlements.json")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "pools.json")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "version.json")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "subscriptions.json")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "/etc/rhsm")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "/var/log/rhsm")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, "/var/lib/rhsm")) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'productCertDir'))) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'entitlementCertDir'))) is not None)
|
|
|
2d607d |
- self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'consumerCertDir'))) is not None)
|
|
|
2d607d |
- shutil.rmtree(path)
|
|
|
2d607d |
+ try:
|
|
|
2d607d |
+ tar_path = path_join(path, "rhsm-debug-system-%s.tar.gz" % self.time_code)
|
|
|
2d607d |
+ tar_file = tarfile.open(tar_path, "r")
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "consumer.json")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "compliance.json")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "entitlements.json")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "pools.json")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "version.json")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "subscriptions.json")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "/etc/rhsm")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "/var/log/rhsm")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, "/var/lib/rhsm")) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'productCertDir'))) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'entitlementCertDir'))) is not None)
|
|
|
2d607d |
+ self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'consumerCertDir'))) is not None)
|
|
|
2d607d |
+ finally:
|
|
|
2d607d |
+ shutil.rmtree(path)
|
|
|
2d607d |
|
|
|
2d607d |
# Runs the non-tar tree creation.
|
|
|
2d607d |
# It does not write the certs or log files because of
|
|
|
2d607d |
@@ -98,22 +100,76 @@ class TestCompileCommand(TestCliCommand):
|
|
|
2d607d |
except SystemExit:
|
|
|
2d607d |
self.fail("Exception Raised")
|
|
|
2d607d |
|
|
|
2d607d |
- tree_path = path_join(path, self.code)
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "consumer.json")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "compliance.json")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "entitlements.json")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "pools.json")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "version.json")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "subscriptions.json")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "/etc/rhsm")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "/var/log/rhsm")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, "/var/lib/rhsm")))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'productCertDir'))))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'entitlementCertDir'))))
|
|
|
2d607d |
- self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'consumerCertDir'))))
|
|
|
2d607d |
- shutil.rmtree(path)
|
|
|
2d607d |
-
|
|
|
2d607d |
- # by not creating of the destination directory
|
|
|
2d607d |
+ try:
|
|
|
2d607d |
+ tree_path = path_join(path, self.code)
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "consumer.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "compliance.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "entitlements.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "pools.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "version.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "subscriptions.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "/etc/rhsm")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "/var/log/rhsm")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "/var/lib/rhsm")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'productCertDir'))))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'entitlementCertDir'))))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'consumerCertDir'))))
|
|
|
2d607d |
+ finally:
|
|
|
2d607d |
+ shutil.rmtree(path)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ # Runs the non-tar tree creation.
|
|
|
2d607d |
+ # sos flag limits included data
|
|
|
2d607d |
+ def test_command_sos(self):
|
|
|
2d607d |
+ try:
|
|
|
2d607d |
+ self.cc._do_command = self._orig_do_command
|
|
|
2d607d |
+ self.cc._make_code = self._make_code
|
|
|
2d607d |
+ self.cc._get_assemble_dir = self._get_assemble_dir
|
|
|
2d607d |
+ self.cc._copy_directory = self._copy_directory
|
|
|
2d607d |
+ self.cc._makedir = self._makedir
|
|
|
2d607d |
+ self.test_dir = os.getcwd()
|
|
|
2d607d |
+ path = path_join(self.test_dir, "testing-dir")
|
|
|
2d607d |
+ self.cc.main(["--destination", path, "--no-archive", "--sos"])
|
|
|
2d607d |
+ except SystemExit:
|
|
|
2d607d |
+ self.fail("Exception Raised")
|
|
|
2d607d |
+
|
|
|
2d607d |
+ try:
|
|
|
2d607d |
+ tree_path = path_join(path, self.code)
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "consumer.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "compliance.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "entitlements.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "pools.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "version.json")))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(tree_path, "subscriptions.json")))
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(tree_path, "/etc/rhsm")))
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(tree_path, "/var/log/rhsm")))
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(tree_path, "/var/lib/rhsm")))
|
|
|
2d607d |
+ # if cert directories are default, these should not be included
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'productCertDir'))))
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'entitlementCertDir'))))
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'consumerCertDir'))))
|
|
|
2d607d |
+ finally:
|
|
|
2d607d |
+ shutil.rmtree(path)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ # Test to see that the filter on copy directory properly skips any -key.pem files
|
|
|
2d607d |
+ def test_copy_private_key_filter(self):
|
|
|
2d607d |
+ path1 = "./test-key-filter"
|
|
|
2d607d |
+ path2 = "./result-dir"
|
|
|
2d607d |
+ if not os.path.exists(path1):
|
|
|
2d607d |
+ os.makedirs(path1)
|
|
|
2d607d |
+ try:
|
|
|
2d607d |
+ open(path_join(path1, "12346.pem"), 'a').close()
|
|
|
2d607d |
+ open(path_join(path1, "7890.pem"), 'a').close()
|
|
|
2d607d |
+ open(path_join(path1, "22222-key.pem"), 'a').close()
|
|
|
2d607d |
+ self.cc._copy_cert_directory(path1, path2)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(path2, path_join(path1, "12346.pem"))))
|
|
|
2d607d |
+ self.assertTrue(os.path.exists(path_join(path2, path_join(path1, "7890.pem"))))
|
|
|
2d607d |
+ self.assertFalse(os.path.exists(path_join(path2, path_join(path1, "22222-key.pem"))))
|
|
|
2d607d |
+ finally:
|
|
|
2d607d |
+ shutil.rmtree(path1)
|
|
|
2d607d |
+ shutil.rmtree(path2)
|
|
|
2d607d |
+
|
|
|
2d607d |
+ # by not creating the destination directory
|
|
|
2d607d |
# we expect the validation to fail
|
|
|
2d607d |
def test_archive_to_non_exist_dir(self):
|
|
|
2d607d |
self.test_dir = os.getcwd()
|
|
|
2d607d |
@@ -144,7 +200,7 @@ class TestCompileCommand(TestCliCommand):
|
|
|
2d607d |
return self.assemble_path
|
|
|
2d607d |
|
|
|
2d607d |
# write to my directory instead
|
|
|
2d607d |
- def _copy_directory(self, path, prefix):
|
|
|
2d607d |
+ def _copy_directory(self, path, prefix, ignore_pats=[]):
|
|
|
2d607d |
#print "_copy_directory: %s, %s" % (path, prefix)
|
|
|
2d607d |
shutil.copytree(path_join(self.assemble_path, path), path_join(prefix, path))
|
|
|
2d607d |
|