Blob Blame History Raw
diff --git a/Makefile b/Makefile
index f773ca4..f37573b 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ EXAMPLE_PLUGINS_SRC_DIR := example-plugins/
 YUM_PLUGINS_SRC_DIR := $(BASE_SRC_DIR)/plugins
 ALL_SRC_DIRS := $(SRC_DIR) $(RCT_SRC_DIR) $(RD_SRC_DIR) $(DAEMONS_SRC_DIR) $(EXAMPLE_PLUGINS_SRC_DIR) $(YUM_PLUGINS_SRC_DIR)

-CFLAGS = -Wall -g
+CFLAGS ?= -g -Wall

 %.pyc: %.py
 	python -c "import py_compile; py_compile.compile('$<')"
diff --git a/etc-conf/rhsm-debug.completion.sh b/etc-conf/rhsm-debug.completion.sh
index 36483fb..14227f3 100644
--- a/etc-conf/rhsm-debug.completion.sh
+++ b/etc-conf/rhsm-debug.completion.sh
@@ -17,7 +17,7 @@ _rhsm-debug()
     system)
         case "${cur}" in
             -*)
-                local opts="--destination --no-archive ${_rhsm_debug_common_opts}"
+                local opts="--destination --no-archive --sos ${_rhsm_debug_common_opts}"
                 COMPREPLY=( $( compgen -W "${opts}" -- "$cur" ) )
                 return 0
                 ;;
diff --git a/man/rhsm-debug.8 b/man/rhsm-debug.8
index ef2151f..74e69dc 100644
--- a/man/rhsm-debug.8
+++ b/man/rhsm-debug.8
@@ -55,6 +55,10 @@ The directory to place the resulting debug data. The default is /tmp.
 .B --no-archive
 Generates an uncompressed directory intead of a gzipped file.

+.TP
+.B --sos
+Eliminiates the information that has already been collected by the SOS report process.
+

 .SH BUGS
 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.
diff --git a/rel-eng/packages/subscription-manager b/rel-eng/packages/subscription-manager
index b52ea0a..abf9a7a 100644
--- a/rel-eng/packages/subscription-manager
+++ b/rel-eng/packages/subscription-manager
@@ -1 +1 @@
-1.10.14-1 ./
+1.10.14-2 ./
diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf
index 5535100..fe97c99 100644
--- a/rel-eng/releasers.conf
+++ b/rel-eng/releasers.conf
@@ -1,56 +1,4 @@
-[yum-f19-x86_64]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = fedora-19-x86_64
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-19/x86_64/
-
-[yum-f19-i386]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = fedora-19-i386
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-19/i386/
-
-[yum-f18-x86_64]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = fedora-18-x86_64
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-18/x86_64/
-
-[yum-f18-i386]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = fedora-18-i386
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/fedora-18/i386/
-
-[yum-el6-x86_64]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = epel-6-x86_64
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6Server/x86_64/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6/x86_64/
-
-[yum-el6-i386]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = epel-6-i386
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6Server/i386/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-6/i386/
-
-[yum-el5-x86_64]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = epel-5-x86_64
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5Server/x86_64/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5/x86_64/
-
-[yum-el5-i386]
-releaser = tito.release.YumRepoReleaser
-builder = tito.builder.MockBuilder
-builder.mock = epel-5-i386
-rsync = fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5Server/i386/ fedorapeople.org:/srv/repos/candlepin/subscription-manager/epel-5/i386/
-
 [rhel-7.0]
 releaser = tito.release.DistGitReleaser
 branches = rhel-7.0

-[fedora]
-releaser = tito.release.FedoraGitReleaser
-branches = master f20 f19
-
diff --git a/rel-eng/tito.props b/rel-eng/tito.props
index 7e29003..17792b0 100644
--- a/rel-eng/tito.props
+++ b/rel-eng/tito.props
@@ -1,8 +1,4 @@
 [globalconfig]
-default_builder = tito.builder.Builder
-default_tagger = tito.tagger.VersionTagger
-
-[cvs]
-cvsroot = :gserver:cvs.devel.redhat.com:/cvs/dist
-branches = RHEL-6
+default_builder = tito.builder.UpstreamBuilder
+default_tagger = tito.tagger.ReleaseTagger

diff --git a/src/rhsm_debug/debug_commands.py b/src/rhsm_debug/debug_commands.py
index e56ce0d..22ef9ad 100644
--- a/src/rhsm_debug/debug_commands.py
+++ b/src/rhsm_debug/debug_commands.py
@@ -20,6 +20,7 @@ import shutil
 import logging
 import tarfile
 from datetime import datetime
+from shutil import ignore_patterns

 import subscription_manager.injection as inj
 import subscription_manager.managercli as managercli
@@ -38,6 +39,7 @@ NOT_REGISTERED = _("This system is not yet registered. Try 'subscription-manager

 ASSEMBLE_DIR = '/var/spool/rhsm/debug'
 ROOT_READ_ONLY = 0600
+KEY_IGNORE_PATS = ['*key.pem']


 class SystemCommand(CliCommand):
@@ -54,6 +56,9 @@ class SystemCommand(CliCommand):
         self.parser.add_option("--no-archive", action='store_false',
                                default=True, dest="archive",
                                help=_("data will be in an uncompressed directory"))
+        self.parser.add_option("--sos", action='store_true',
+                               default=False, dest="sos",
+                               help=_("only data not already included in sos report will be collected"))

     def _get_usage(self):
         return _("%%prog %s [OPTIONS] ") % self.name
@@ -103,12 +108,18 @@ class SystemCommand(CliCommand):
                                   self._get_version_info())

             # FIXME: we need to anon proxy passwords?
-            self._copy_directory('/etc/rhsm', content_path)
-            self._copy_directory('/var/log/rhsm', content_path)
-            self._copy_directory('/var/lib/rhsm', content_path)
-            self._copy_directory(cfg.get('rhsm', 'productCertDir'), content_path)
-            self._copy_directory(cfg.get('rhsm', 'entitlementCertDir'), content_path)
-            self._copy_directory(cfg.get('rhsm', 'consumerCertDir'), content_path)
+            sos = self.options.sos
+            defaults = cfg.defaults()
+            if defaults['productcertdir'] != cfg.get('rhsm', 'productCertDir') or not sos:
+                self._copy_cert_directory(cfg.get('rhsm', 'productCertDir'), content_path)
+            if defaults['entitlementcertdir'] != cfg.get('rhsm', 'entitlementCertDir') or not sos:
+                self._copy_cert_directory(cfg.get('rhsm', 'entitlementCertDir'), content_path)
+            if defaults['consumercertdir'] != cfg.get('rhsm', 'consumerCertDir') or not sos:
+                self._copy_cert_directory(cfg.get('rhsm', 'consumerCertDir'), content_path)
+            if not sos:
+                self._copy_directory('/etc/rhsm', content_path)
+                self._copy_directory('/var/log/rhsm', content_path)
+                self._copy_directory('/var/lib/rhsm', content_path)

             # build an archive by default
             if self.options.archive:
@@ -158,11 +169,20 @@ class SystemCommand(CliCommand):
         with open(path, "w+") as fo:
             fo.write(json.dumps(content, indent=4, sort_keys=True))

-    def _copy_directory(self, src_path, dest_path):
+    def _copy_directory(self, src_path, dest_path, ignore_pats=[]):
         rel_path = src_path
         if os.path.isabs(src_path):
             rel_path = src_path[1:]
-        shutil.copytree(src_path, os.path.join(dest_path, rel_path))
+        if ignore_pats is not None:
+            shutil.copytree(src_path, os.path.join(dest_path, rel_path),
+                ignore=ignore_patterns(*ignore_pats))
+        else:
+            shutil.copytree(src_path, os.path.join(dest_path, rel_path))
+
+    def _copy_cert_directory(self, src_path, dest_path):
+        self._copy_directory(src_path,
+                             dest_path,
+                             KEY_IGNORE_PATS)

     def _get_assemble_dir(self):
         return ASSEMBLE_DIR
diff --git a/src/subscription_manager/gui/data/choose_server.glade b/src/subscription_manager/gui/data/choose_server.glade
index b913a42..15572a8 100644
--- a/src/subscription_manager/gui/data/choose_server.glade
+++ b/src/subscription_manager/gui/data/choose_server.glade
@@ -156,18 +156,19 @@
               <widget class="GtkHBox" id="hbox3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">25</property>
+                <property name="spacing">5</property>
                 <child>
                   <widget class="GtkCheckButton" id="activation_key_checkbox">
                     <property name="label" translatable="yes">I will use an Activation Key</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -175,7 +176,8 @@
                   <widget class="GtkAlignment" id="alignment3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="right_padding">16</property>
+                    <property name="xalign">0</property>
+                    <property name="left_padding">5</property>
                     <child>
                       <widget class="GtkImage" id="image3">
                         <property name="visible">True</property>
@@ -187,7 +189,7 @@
                     </child>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="position">1</property>
                   </packing>
@@ -198,7 +200,6 @@
                 <property name="right_attach">2</property>
                 <property name="top_attach">1</property>
                 <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_EXPAND</property>
               </packing>
             </child>
           </widget>
diff --git a/src/subscription_manager/productid.py b/src/subscription_manager/productid.py
index 4c3cdf2..698f5d2 100644
--- a/src/subscription_manager/productid.py
+++ b/src/subscription_manager/productid.py
@@ -19,7 +19,6 @@ import gettext
 from gzip import GzipFile
 import logging
 import os
-import re
 import types
 import yum

@@ -27,6 +26,7 @@ from rhsm.certificate import create_from_pem

 from subscription_manager.certdirectory import Directory
 from subscription_manager.injection import PLUGIN_MANAGER, require
+from subscription_manager import rhelproduct
 import subscription_manager.injection as inj
 from rhsm import ourjson as json

@@ -101,23 +101,6 @@ class ProductDatabase:
         return self.dir.abspath('productid.js')


-class RHELProductMatcher(object):
-    def __init__(self, product=None):
-        self.product = product
-        # Match "rhel-6" or "rhel-11"
-        # but not "rhel-6-server" or "rhel-6-server-highavailabilty"
-        self.pattern = "rhel-\d+$"
-
-    def is_rhel(self):
-        """return true if this is a rhel product cert"""
-
-        for tag in self.product.provided_tags:
-            if re.match(self.pattern, tag):
-                return True
-
-        return False
-
-
 class ProductManager:
     """Manager product certs, detecting when they need to be installed, or deleted.

@@ -395,7 +378,7 @@ class ProductManager:
             # is not 'active'. So it ends up deleting the product cert for rhel since
             # it appears it is not being used. It is kind of a strange case for the
             # base os product cert, so we hardcode a special case here.
-            rhel_matcher = RHELProductMatcher(p)
+            rhel_matcher = rhelproduct.RHELProductMatcher(p)
             if rhel_matcher.is_rhel():
                 delete_product_cert = False

diff --git a/src/subscription_manager/release.py b/src/subscription_manager/release.py
index 228b261..4b4fb9d 100644
--- a/src/subscription_manager/release.py
+++ b/src/subscription_manager/release.py
@@ -27,6 +27,7 @@ import rhsm.config

 from subscription_manager.facts import Facts
 from subscription_manager import listing
+from subscription_manager import rhelproduct

 _ = gettext.gettext

@@ -55,21 +56,21 @@ class ReleaseBackend(object):
                                prod_dir=self.product_dir)

         # find the rhel product
-        rhel_product = None
+        release_product = None
         installed_products = self.product_dir.get_installed_products()
         for product_hash in installed_products:
             product_cert = installed_products[product_hash]
             products = product_cert.products
             for product in products:
-                product_tags = product.provided_tags
+                rhel_matcher = rhelproduct.RHELProductMatcher(product)
+                if rhel_matcher.is_rhel():
+                    release_product = product

-                if self._is_rhel(product_tags):
-                    rhel_product = product
-
-        if rhel_product is None:
+        if release_product is None:
+            log.info("No products with RHEL product tags found")
             return []

-        entitlements = self.entitlement_dir.list_for_product(rhel_product.id)
+        entitlements = self.entitlement_dir.list_for_product(release_product.id)
         listings = []
         for entitlement in entitlements:
             contents = entitlement.content
@@ -78,7 +79,7 @@ class ReleaseBackend(object):
                 # see bz #820639
                 if not content.enabled:
                     continue
-                if self._is_correct_rhel(rhel_product.provided_tags,
+                if self._is_correct_rhel(release_product.provided_tags,
                                          content.required_tags):
                     listing_path = self._build_listing_path(content.url)
                     listings.append(listing_path)
@@ -125,22 +126,8 @@ class ReleaseBackend(object):
         # FIXME: cleanup paths ("//"'s, etc)
         return listing_path

-    def _is_rhel(self, product_tags):
-        #easy to pass a string instead of a list
-        assert not isinstance(product_tags, basestring)
-
-        for product_tag in product_tags:
-            # so in theory, we should only have one rhel
-            # product. Not sure what to do if we have
-            # more than one. Probably throw an error
-            # TESTME
-            if product_tag.split('-', 1)[0] == "rhel":
-                # we only need to match the first hit
-                return True
-        log.info("No products with RHEL product tags found")
-        return False
-
     # require tags provided by installed products?
+
     def _is_correct_rhel(self, product_tags, content_tags):
         # easy to pass a string instead of a list
         assert not isinstance(product_tags, basestring)
diff --git a/src/subscription_manager/rhelproduct.py b/src/subscription_manager/rhelproduct.py
new file mode 100644
index 0000000..64192a6
--- /dev/null
+++ b/src/subscription_manager/rhelproduct.py
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2014 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.
+#
+#
+# RHEL product specific code
+#
+
+import re
+
+
+# NOTE: This class compares a Product that could be from a ProductCertificate
+#       or from an Entitlement. Product's from Entitlements may include a
+#       brand_type attribute. A Product that represents a RHEL base os
+#       may or may not be a RHEL "branded" Product. See rhelentbranding for
+#       code that handles finding and comparing RHEL "branded" Product objects.
+#
+class RHELProductMatcher(object):
+    """Check a Product object to see if it is a RHEL product.
+
+    Compares the provided tags to see if any provide 'rhel-VERSION'.
+    """
+    def __init__(self, product=None):
+        self.product = product
+        # Match "rhel-6" or "rhel-11"
+        # but not "rhel-6-server" or "rhel-6-server-highavailabilty"
+        self.pattern = "rhel-\d+$"
+
+    def is_rhel(self):
+        """return true if this is a rhel product cert"""
+
+        return any([re.match(self.pattern, tag)
+                    for tag in self.product.provided_tags])
diff --git a/subscription-manager.spec b/subscription-manager.spec
index 1fdb3c3..02eaafb 100644
--- a/subscription-manager.spec
+++ b/subscription-manager.spec
@@ -6,6 +6,9 @@

 %define rhsm_plugins_dir   /usr/share/rhsm-plugins

+
+%global _hardened_build 1
+
 # A couple files are for RHEL 5 only:
 %if 0%{?rhel} == 5
 %define el5 1
@@ -13,7 +16,7 @@

 Name: subscription-manager
 Version: 1.10.14
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: Tools and libraries for subscription and repository management
 Group:   System Environment/Base
 License: GPLv2
@@ -140,7 +143,7 @@ subscriptions
 %setup -q

 %build
-make -f Makefile
+make -f Makefile CFLAGS="%{optflags}"

 %install
 rm -rf %{buildroot}
@@ -246,6 +249,7 @@ rm -rf %{buildroot}
 %{_datadir}/rhsm/subscription_manager/release.py*
 %{_datadir}/rhsm/subscription_manager/repolib.py*
 %{_datadir}/rhsm/subscription_manager/rhelentbranding.py*
+%{_datadir}/rhsm/subscription_manager/rhelproduct.py*
 %{_datadir}/rhsm/subscription_manager/utils.py*
 %{_datadir}/rhsm/subscription_manager/printing_utils.py*
 %{_datadir}/rhsm/subscription_manager/validity.py*
@@ -418,6 +422,14 @@ fi
 %endif

 %changelog
+* Tue Feb 18 2014 ckozak <ckozak@redhat.com> 1.10.14-2
+- updated tito.props to rev release (ckozak@redhat.com)
+- 958016: use rpm %%{optflags} and _hardended_build (alikins@redhat.com)
+- 851325: Tweak activation key checkbox to left (alikins@redhat.com)
+- 1044596: Don't match beta product tags for release (alikins@redhat.com)
+- 1060727: Changes to rhsm-debug for sos report (wpoteat@redhat.com)
+- removed other releasers (ckozak@redhat.com)
+
 * Tue Feb 11 2014 ckozak <ckozak@redhat.com> 1.10.14-1
 - Use glob for finding entitlement certs to remove. (dgoodwin@redhat.com)
 - Make sure entitlement cert directory exists before we clean it out.
diff --git a/test/test_productid.py b/test/test_productid.py
index f1e6162..fbac60b 100644
--- a/test/test_productid.py
+++ b/test/test_productid.py
@@ -151,81 +151,6 @@ class TestProductDatabase(unittest.TestCase):
         self.assertEquals(len_content, len_content2)


-# matches:
-#  rhel-6
-# not matches
-#  rhel-6-server-highavailibity
-#  rhel-6-computenode-hpn
-#  rhel-6-hpn
-#  rhel-6-server-resilientstorage
-#  rhel-6-resilientstorage
-class TestRHELProductMatcher(SubManFixture):
-
-    matches = ["rhel-6,rhel-6-client",
-               "rhel-6,rhel-6-client",
-               "rhel-6,rhel-6-computenode",
-               "rhel-6,rhel-6-server",
-               "rhel-6,rhel-6-ibm-power",
-               "rhel-6,rhel-6-ibm-system-z",
-               "rhel-6,rhel-6-server",
-               "rhel-6,rhel-6-workstation",
-               "rhel-6,rhel-6-workstation",
-               "rhel-11",
-               "rhel-6,rhel-6-someotherthing",
-               "rhel-11,rhel-11-something"]
-
-    not_matches = ["rhel-5-server-scalablefilesystem,rhel-5-scalablefilesystem",
-                   "rhel-5-server-clusterstorage,rhel-5-clusterstorage",
-                   "rhel-6-server-highavailibity",
-                   "rhel-6-server-loadbalancer,rhel-6-loadbalancer",
-                   "rhel-6-ibm-system-z",
-                   "rhel-somethingelse",
-                   "rhel",
-                   "rhel-rhel-rhelly-rhel",
-                   "rhel-",
-                   "rhev-3",
-                   "what-is-this-rhel-6",
-                   "not-rhel-6",
-                   "stillnotrhel-6",
-                   "rhel-6-rhel-6",
-                   "el-6",
-                   "rhel-6.1",
-                   "rhel-11-but-this-rhel-goes-to-11",
-                   "rhel-11.11",
-                   "fedora-20",
-                   "awsomeos-11",
-                   "6"]
-
-    def test_matches(self):
-        for tag in self.matches:
-            self._assert_is_rhel(tag)
-
-    def test_not_matches(self):
-        for tag in self.not_matches:
-            self._assert_is_not_rhel(tag)
-
-    def _assert_is_rhel(self, tags):
-        matcher = self._build_matcher(tags)
-        is_rhel = matcher.is_rhel()
-        if not is_rhel:
-            self.fail("RHELProductMatcher fail: %s is a rhel product tag but matcher failed" % tags)
-
-    def _assert_is_not_rhel(self, tags):
-        matcher = self._build_matcher(tags)
-        is_rhel = matcher.is_rhel()
-        if is_rhel:
-            self.fail("RHELProductMatcher fail: %s is NOT a rhel product tag but matcher did not fail" % tags)
-
-    def _build_matcher(self, tags):
-        # NOTE:  Matcher only looks at tags atm
-        product = stubs.StubProduct("69", "Red Hat Enterprise Linux Server",
-                                    version="6.2",
-                                    provided_tags=tags)
-
-        matcher = productid.RHELProductMatcher(product)
-        return matcher
-
-
 class TestProductManager(SubManFixture):

     def setUp(self):
diff --git a/test/test_release.py b/test/test_release.py
index 0775f98..1d7e2d0 100644
--- a/test/test_release.py
+++ b/test/test_release.py
@@ -56,26 +56,70 @@ class TestReleaseBackend(fixture.SubManFixture):
         stub_product = stubs.StubProduct("rhel-6")
         stub_entitlement_certs = [stubs.StubEntitlementCertificate(stub_product,
                                                                    content=stub_contents)]
-        stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
+        self.stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)

-        stub_product_dir = stubs.StubProductDirectory(
+        self.stub_product_dir = stubs.StubProductDirectory(
             [stubs.StubProductCertificate(
                     stubs.StubProduct("rhel-6",
-                                      provided_tags="rhel-6-stub"),)])
+                                      provided_tags="rhel-6,rhel-6-stub"),)])

         def get_versions(dummy):
             return versions
-        stub_content_connection = stubs.StubContentConnection()
-        stub_content_connection.get_versions = get_versions
+        self.stub_content_connection = stubs.StubContentConnection()
+        self.stub_content_connection.get_versions = get_versions

-        self.rb = release.ReleaseBackend(ent_dir=stub_entitlement_dir,
-                                         prod_dir=stub_product_dir,
-                                         content_connection=stub_content_connection)
+        self.rb = release.ReleaseBackend(ent_dir=self.stub_entitlement_dir,
+                                         prod_dir=self.stub_product_dir,
+                                         content_connection=self.stub_content_connection)

     def test_get_releases(self):
         releases = self.rb.get_releases()
         self.assertNotEquals([], releases)

+    def test_get_releases_no_rhel(self):
+        stub_product_dir = stubs.StubProductDirectory(
+            [stubs.StubProductCertificate(
+                    stubs.StubProduct("rhel-6-something",
+                                      provided_tags="rhel-6-something,rhel-6-stub"),)])
+
+        self.rb = release.ReleaseBackend(ent_dir=self.stub_entitlement_dir,
+                                         prod_dir=stub_product_dir,
+                                         content_connection=self.stub_content_connection)
+        releases = self.rb.get_releases()
+        self.assertEquals([], releases)
+
+    def test_get_releases_rhel_no_content(self):
+
+        stub_content_5 = stubs.StubContent("c5", required_tags="AwesomeOS",
+                                           gpg=None, enabled="1")
+
+        stub_product = stubs.StubProduct("rhel-6")
+        stub_entitlement_certs = [stubs.StubEntitlementCertificate(stub_product,
+                                                                   content=[stub_content_5])]
+
+        stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
+        self.rb = release.ReleaseBackend(ent_dir=stub_entitlement_dir,
+                                         prod_dir=self.stub_product_dir,
+                                         content_connection=self.stub_content_connection)
+        releases = self.rb.get_releases()
+        self.assertEquals([], releases)
+
+    def test_get_releases_rhel_no_enabled_content(self):
+
+        stub_content_6 = stubs.StubContent("c6", required_tags="rhel-6",
+                                           gpg=None, enabled="0")
+
+        stub_product = stubs.StubProduct("rhel-6")
+        stub_entitlement_certs = [stubs.StubEntitlementCertificate(stub_product,
+                                                                   content=[stub_content_6])]
+
+        stub_entitlement_dir = stubs.StubEntitlementDirectory(stub_entitlement_certs)
+        self.rb = release.ReleaseBackend(ent_dir=stub_entitlement_dir,
+                                         prod_dir=self.stub_product_dir,
+                                         content_connection=self.stub_content_connection)
+        releases = self.rb.get_releases()
+        self.assertEquals([], releases)
+
     def test_get_releases_throws_exception(self):
         with mock.patch.object(self.rb, 'content_connection') as mock_cc:
             mock_cc.get_versions.side_effect = \
@@ -93,14 +137,6 @@ class TestReleaseBackend(fixture.SubManFixture):
             releases = self.rb.get_releases()
             self.assertEquals([], releases)

-    def test_is_rhel(self):
-        ir = self.rb._is_rhel(["rhel-6-test"])
-        self.assertTrue(ir)
-
-    def test_is_not_rhel(self):
-        ir = self.rb._is_rhel(["awesome-test"])
-        self.assertFalse(ir)
-
     def test_is_correct_rhel(self):
         icr = self.rb._is_correct_rhel(["rhel-6-test"], ["rhel-6"])
         self.assertTrue(icr)
diff --git a/test/test_rhelproduct.py b/test/test_rhelproduct.py
new file mode 100644
index 0000000..db8049a
--- /dev/null
+++ b/test/test_rhelproduct.py
@@ -0,0 +1,81 @@
+
+import stubs
+
+from subscription_manager import rhelproduct
+
+from fixture import SubManFixture
+
+
+# matches:
+#  rhel-6
+# not matches
+#  rhel-6-server-highavailibity
+#  rhel-6-computenode-hpn
+#  rhel-6-hpn
+#  rhel-6-server-resilientstorage
+#  rhel-6-resilientstorage
+class TestRHELProductMatcher(SubManFixture):
+
+    matches = ["rhel-6,rhel-6-client",
+               "rhel-6,rhel-6-client",
+               "rhel-6,rhel-6-computenode",
+               "rhel-6,rhel-6-server",
+               "rhel-6,rhel-6-ibm-power",
+               "rhel-6,rhel-6-ibm-system-z",
+               "rhel-6,rhel-6-server",
+               "rhel-6,rhel-6-workstation",
+               "rhel-6,rhel-6-workstation",
+               "rhel-11",
+               "rhel-6,rhel-6-someotherthing",
+               "rhel-11,rhel-11-something"]
+
+    not_matches = ["rhel-5-server-scalablefilesystem,rhel-5-scalablefilesystem",
+                   "rhel-5-server-clusterstorage,rhel-5-clusterstorage",
+                   "rhel-6-server-highavailibity",
+                   "rhel-6-server-loadbalancer,rhel-6-loadbalancer",
+                   "rhel-6-ibm-system-z",
+                   "rhel-somethingelse",
+                   "rhel",
+                   "rhel-rhel-rhelly-rhel",
+                   "rhel-",
+                   "rhev-3",
+                   "what-is-this-rhel-6",
+                   "not-rhel-6",
+                   "stillnotrhel-6",
+                   "rhel-6-rhel-6",
+                   "el-6",
+                   "rhel-6.1",
+                   "rhel-11-but-this-rhel-goes-to-11",
+                   "rhel-11.11",
+                   "fedora-20",
+                   "awsomeos-11",
+                   "6"]
+
+    def test_matches(self):
+        for tag in self.matches:
+            self._assert_is_rhel(tag)
+
+    def test_not_matches(self):
+        for tag in self.not_matches:
+            self._assert_is_not_rhel(tag)
+
+    def _assert_is_rhel(self, tags):
+        matcher = self._build_matcher(tags)
+        is_rhel = matcher.is_rhel()
+        if not is_rhel:
+            self.fail("RHELProductMatcher fail: %s is a rhel product tag but matcher failed" % tags)
+
+    def _assert_is_not_rhel(self, tags):
+        matcher = self._build_matcher(tags)
+        is_rhel = matcher.is_rhel()
+        if is_rhel:
+            self.fail("RHELProductMatcher fail: %s is NOT a rhel product tag but matcher did not fail" % tags)
+
+    def _build_matcher(self, tags):
+        # NOTE:  Matcher only looks at tags atm
+        product = stubs.StubProduct("69", "Red Hat Enterprise Linux Server",
+                                    version="6.2",
+                                    provided_tags=tags)
+
+        matcher = rhelproduct.RHELProductMatcher(product)
+        return matcher
diff --git a/test/test_rhsm_debug_command.py b/test/test_rhsm_debug_command.py
index 280a674..cd762e3 100644
--- a/test/test_rhsm_debug_command.py
+++ b/test/test_rhsm_debug_command.py
@@ -66,21 +66,23 @@ class TestCompileCommand(TestCliCommand):
         except SystemExit:
             self.fail("Exception Raised")

-        tar_path = path_join(path, "rhsm-debug-system-%s.tar.gz" % self.time_code)
-        tar_file = tarfile.open(tar_path, "r")
-        self.assertTrue(tar_file.getmember(path_join(self.code, "consumer.json")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "compliance.json")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "entitlements.json")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "pools.json")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "version.json")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "subscriptions.json")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "/etc/rhsm")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "/var/log/rhsm")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, "/var/lib/rhsm")) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'productCertDir'))) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'entitlementCertDir'))) is not None)
-        self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'consumerCertDir'))) is not None)
-        shutil.rmtree(path)
+        try:
+            tar_path = path_join(path, "rhsm-debug-system-%s.tar.gz" % self.time_code)
+            tar_file = tarfile.open(tar_path, "r")
+            self.assertTrue(tar_file.getmember(path_join(self.code, "consumer.json")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "compliance.json")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "entitlements.json")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "pools.json")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "version.json")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "subscriptions.json")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "/etc/rhsm")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "/var/log/rhsm")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, "/var/lib/rhsm")) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'productCertDir'))) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'entitlementCertDir'))) is not None)
+            self.assertTrue(tar_file.getmember(path_join(self.code, cfg.get('rhsm', 'consumerCertDir'))) is not None)
+        finally:
+            shutil.rmtree(path)

     # Runs the non-tar tree creation.
     # It does not write the certs or log files because of
@@ -98,22 +100,76 @@ class TestCompileCommand(TestCliCommand):
         except SystemExit:
             self.fail("Exception Raised")

-        tree_path = path_join(path, self.code)
-        self.assertTrue(os.path.exists(path_join(tree_path, "consumer.json")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "compliance.json")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "entitlements.json")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "pools.json")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "version.json")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "subscriptions.json")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "/etc/rhsm")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "/var/log/rhsm")))
-        self.assertTrue(os.path.exists(path_join(tree_path, "/var/lib/rhsm")))
-        self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'productCertDir'))))
-        self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'entitlementCertDir'))))
-        self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'consumerCertDir'))))
-        shutil.rmtree(path)
-
-    # by not creating of the destination directory
+        try:
+            tree_path = path_join(path, self.code)
+            self.assertTrue(os.path.exists(path_join(tree_path, "consumer.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "compliance.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "entitlements.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "pools.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "version.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "subscriptions.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "/etc/rhsm")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "/var/log/rhsm")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "/var/lib/rhsm")))
+            self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'productCertDir'))))
+            self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'entitlementCertDir'))))
+            self.assertTrue(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'consumerCertDir'))))
+        finally:
+            shutil.rmtree(path)
+
+    # Runs the non-tar tree creation.
+    # sos flag limits included data
+    def test_command_sos(self):
+        try:
+            self.cc._do_command = self._orig_do_command
+            self.cc._make_code = self._make_code
+            self.cc._get_assemble_dir = self._get_assemble_dir
+            self.cc._copy_directory = self._copy_directory
+            self.cc._makedir = self._makedir
+            self.test_dir = os.getcwd()
+            path = path_join(self.test_dir, "testing-dir")
+            self.cc.main(["--destination", path, "--no-archive", "--sos"])
+        except SystemExit:
+            self.fail("Exception Raised")
+
+        try:
+            tree_path = path_join(path, self.code)
+            self.assertTrue(os.path.exists(path_join(tree_path, "consumer.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "compliance.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "entitlements.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "pools.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "version.json")))
+            self.assertTrue(os.path.exists(path_join(tree_path, "subscriptions.json")))
+            self.assertFalse(os.path.exists(path_join(tree_path, "/etc/rhsm")))
+            self.assertFalse(os.path.exists(path_join(tree_path, "/var/log/rhsm")))
+            self.assertFalse(os.path.exists(path_join(tree_path, "/var/lib/rhsm")))
+            # if cert directories are default, these should not be included
+            self.assertFalse(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'productCertDir'))))
+            self.assertFalse(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'entitlementCertDir'))))
+            self.assertFalse(os.path.exists(path_join(tree_path, cfg.get('rhsm', 'consumerCertDir'))))
+        finally:
+            shutil.rmtree(path)
+
+    # Test to see that the filter on copy directory properly skips any -key.pem files
+    def test_copy_private_key_filter(self):
+        path1 = "./test-key-filter"
+        path2 = "./result-dir"
+        if not os.path.exists(path1):
+            os.makedirs(path1)
+        try:
+            open(path_join(path1, "12346.pem"), 'a').close()
+            open(path_join(path1, "7890.pem"), 'a').close()
+            open(path_join(path1, "22222-key.pem"), 'a').close()
+            self.cc._copy_cert_directory(path1, path2)
+
+            self.assertTrue(os.path.exists(path_join(path2, path_join(path1, "12346.pem"))))
+            self.assertTrue(os.path.exists(path_join(path2, path_join(path1, "7890.pem"))))
+            self.assertFalse(os.path.exists(path_join(path2, path_join(path1, "22222-key.pem"))))
+        finally:
+            shutil.rmtree(path1)
+            shutil.rmtree(path2)
+
+    # by not creating the destination directory
     #  we expect the validation to fail
     def test_archive_to_non_exist_dir(self):
         self.test_dir = os.getcwd()
@@ -144,7 +200,7 @@ class TestCompileCommand(TestCliCommand):
         return self.assemble_path

     # write to my directory instead
-    def _copy_directory(self, path, prefix):
+    def _copy_directory(self, path, prefix, ignore_pats=[]):
         #print "_copy_directory: %s, %s" % (path, prefix)
         shutil.copytree(path_join(self.assemble_path, path), path_join(prefix, path))