Blame SOURCES/subscription-manager-1.10.14-5-to-subscription-manager-1.10.14-6.patch

2d607d
diff --git a/rel-eng/packages/subscription-manager b/rel-eng/packages/subscription-manager
2d607d
index 5c960bd..ba49163 100644
2d607d
--- a/rel-eng/packages/subscription-manager
2d607d
+++ b/rel-eng/packages/subscription-manager
2d607d
@@ -1 +1 @@
2d607d
-1.10.14-5 ./
2d607d
+1.10.14-6 ./
2d607d
diff --git a/src/rct/printing.py b/src/rct/printing.py
2d607d
index 877d244..bcb965b 100644
2d607d
--- a/src/rct/printing.py
2d607d
+++ b/src/rct/printing.py
2d607d
@@ -50,6 +50,13 @@ class ProductPrinter(object):
2d607d
         if hasattr(product, 'brand_type'):
2d607d
             brand_type = product.brand_type
2d607d
         s.append("\t%s: %s" % (_("Brand Type"), xstr(brand_type)))
2d607d
+
2d607d
+        brand_name = ""
2d607d
+        if hasattr(product, 'brand_name'):
2d607d
+            brand_name = product.brand_name
2d607d
+
2d607d
+        s.append("\t%s: %s" % (_("Brand Name"), xstr(brand_name)))
2d607d
+
2d607d
         return "%s\n" % '\n'.join(s)
2d607d
 
2d607d
 
2d607d
diff --git a/src/subscription_manager/entbranding.py b/src/subscription_manager/entbranding.py
2d607d
index ce1b358..e0d77ce 100644
2d607d
--- a/src/subscription_manager/entbranding.py
2d607d
+++ b/src/subscription_manager/entbranding.py
2d607d
@@ -126,7 +126,7 @@ class ProductBrand(Brand):
2d607d
 
2d607d
     @classmethod
2d607d
     def from_product(cls, product):
2d607d
-        return cls(product.name)
2d607d
+        return cls(product.brand_name)
2d607d
 
2d607d
     @staticmethod
2d607d
     def format_brand(brand):
2d607d
diff --git a/src/subscription_manager/rhelentbranding.py b/src/subscription_manager/rhelentbranding.py
2d607d
index e175d7c..429d199 100644
2d607d
--- a/src/subscription_manager/rhelentbranding.py
2d607d
+++ b/src/subscription_manager/rhelentbranding.py
2d607d
@@ -81,7 +81,7 @@ class RHELBrandPicker(entbranding.BrandPicker):
2d607d
         branded_name_set = set([])
2d607d
         for cert, product in branded_certs:
2d607d
             # uniq on product id and product name
2d607d
-            branded_name_set.add(product.name)
2d607d
+            branded_name_set.add(product.brand_name)
2d607d
 
2d607d
         if len(branded_name_set) == 1:
2d607d
             # all the ent certs provide the same branding info,
2d607d
@@ -94,7 +94,7 @@ class RHELBrandPicker(entbranding.BrandPicker):
2d607d
             for branded_cert in branded_certs:
2d607d
                 log.debug("Entitlement cert %s (%s) provided branded name information for (%s, %s)" %
2d607d
                             (branded_cert[0].serial, branded_cert[0].order.name,
2d607d
-                            branded_cert[1].id, branded_cert[1].name))
2d607d
+                            branded_cert[1].id, branded_cert[1].brand_name))
2d607d
             return None
2d607d
 
2d607d
     def _get_branded_cert_products(self):
2d607d
@@ -155,7 +155,10 @@ class RHELBrandPicker(entbranding.BrandPicker):
2d607d
         elif product.brand_type != 'OS':
2d607d
             return False
2d607d
 
2d607d
-        if not product.name:
2d607d
+        if not hasattr(product, 'brand_name'):
2d607d
+            return False
2d607d
+
2d607d
+        if not product.brand_name:
2d607d
             return False
2d607d
 
2d607d
         return True
2d607d
diff --git a/subscription-manager.spec b/subscription-manager.spec
2d607d
index 492af14..cf2b05c 100644
2d607d
--- a/subscription-manager.spec
2d607d
+++ b/subscription-manager.spec
2d607d
@@ -14,7 +14,7 @@
2d607d
 
2d607d
 Name: subscription-manager
2d607d
 Version: 1.10.14
2d607d
-Release: 5%{?dist}
2d607d
+Release: 6%{?dist}
2d607d
 Summary: Tools and libraries for subscription and repository management
2d607d
 Group:   System Environment/Base
2d607d
 License: GPLv2
2d607d
@@ -419,6 +419,9 @@ fi
2d607d
 %endif
2d607d
 
2d607d
 %changelog
2d607d
+* Fri Mar 21 2014 ckozak <ckozak@redhat.com> 1.10.14-6
2d607d
+- Use the new Product.brand_name for brand_name (alikins@redhat.com)
2d607d
+
2d607d
 * Wed Mar 19 2014 ckozak <ckozak@redhat.com> 1.10.14-5
2d607d
 - 1070908: Don't count cpus without topo for lpar (alikins@redhat.com)
2d607d
 - 865702: Dont render exc messages with bogus markup (alikins@redhat.com)
2d607d
diff --git a/test/certdata.py b/test/certdata.py
2d607d
index 04dbebb..7c5c455 100644
2d607d
--- a/test/certdata.py
2d607d
+++ b/test/certdata.py
2d607d
@@ -242,6 +242,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Product:
2d607d
 	ID: 37065
2d607d
@@ -250,6 +251,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Product:
2d607d
 	ID: 37067
2d607d
@@ -258,6 +260,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Product:
2d607d
 	ID: 37068
2d607d
@@ -266,6 +269,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Product:
2d607d
 	ID: 37069
2d607d
@@ -274,6 +278,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Product:
2d607d
 	ID: 37070
2d607d
@@ -282,6 +287,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Order:
2d607d
 	Name: Awesome OS Server Bundled
2d607d
@@ -402,6 +408,7 @@ Product:
2d607d
 	Arch: x86_64
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 Order:
2d607d
 	Name: Awesome OS for x86_64
2d607d
@@ -497,6 +504,7 @@ Product:
2d607d
 	Arch: x86_64
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
+	Brand Name: 
2d607d
 
2d607d
 """
2d607d
 
2d607d
@@ -527,7 +535,7 @@ Product:
2d607d
 	Arch: ALL
2d607d
 	Tags: 
2d607d
 	Brand Type: 
2d607d
-
2d607d
+	Brand Name: 
2d607d
 """
2d607d
 
2d607d
 IDENTITY_CERT_OUTPUT = """
2d607d
diff --git a/test/stubs.py b/test/stubs.py
2d607d
index c7c4621..a93e770 100644
2d607d
--- a/test/stubs.py
2d607d
+++ b/test/stubs.py
2d607d
@@ -119,7 +119,7 @@ class StubProduct(Product):
2d607d
 
2d607d
     def __init__(self, product_id, name=None, version=None,
2d607d
                  architectures=None, provided_tags=None,
2d607d
-                 os=None):
2d607d
+                 os=None, brand_name=None):
2d607d
 
2d607d
         # Initialize some defaults:
2d607d
         if not name:
2d607d
@@ -138,7 +138,7 @@ class StubProduct(Product):
2d607d
         super(StubProduct, self).__init__(id=product_id, name=name, version=version,
2d607d
                                           architectures=architectures,
2d607d
                                           provided_tags=provided_tags,
2d607d
-                                          brand_type=os)
2d607d
+                                          brand_type=os, brand_name=brand_name)
2d607d
 
2d607d
 
2d607d
 class StubContent(Content):
2d607d
diff --git a/test/test_entbranding.py b/test/test_entbranding.py
2d607d
index 9957509..c0442d3 100644
2d607d
--- a/test/test_entbranding.py
2d607d
+++ b/test/test_entbranding.py
2d607d
@@ -10,20 +10,25 @@ from subscription_manager import injection as inj
2d607d
 
2d607d
 
2d607d
 class StubProduct(object):
2d607d
-    def __init__(self, id=None, name=None, brand_type=None):
2d607d
+    def __init__(self, id=None, name=None,
2d607d
+                 brand_type=None, brand_name=None):
2d607d
         self.id = id
2d607d
         # we need to test when these dont exist
2d607d
         if name:
2d607d
             self.name = name
2d607d
         if brand_type:
2d607d
             self.brand_type = brand_type
2d607d
+        if brand_name:
2d607d
+            self.brand_name = brand_name
2d607d
 
2d607d
 
2d607d
 class DefaultStubProduct(object):
2d607d
-    def __init__(self, id=123, name="Awesome OS", brand_type='OS'):
2d607d
+    def __init__(self, id=123, name="Awesome OS",
2d607d
+                 brand_type='OS', brand_name='Awesome OS super'):
2d607d
         self.id = id
2d607d
         self.name = name
2d607d
         self.brand_type = brand_type
2d607d
+        self.brand_name = brand_name
2d607d
 
2d607d
 
2d607d
 class BaseBrandFixture(fixture.SubManFixture):
2d607d
@@ -113,10 +118,12 @@ class TestRHELBrandInstaller(BaseBrandFixture):
2d607d
         brand_arg = call_args[0][0]
2d607d
         self.assertTrue(isinstance(brand_arg, entbranding.ProductBrand))
2d607d
         self.assertTrue(isinstance(brand_arg, rhelentbranding.RHELProductBrand))
2d607d
-        self.assertEquals("Awesome OS", brand_arg.name)
2d607d
+        self.assertEquals('Awesome OS super', brand_arg.name)
2d607d
 
2d607d
     def test_no_need_to_update_branding(self):
2d607d
-        stub_product = StubProduct(id=123, brand_type='OS', name=self.current_brand)
2d607d
+        stub_product = StubProduct(id=123, brand_type='OS',
2d607d
+                                   name="Some name",
2d607d
+                                   brand_name=self.current_brand)
2d607d
 
2d607d
         mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
         mock_prod_dir.get_installed_products.return_value = [stub_product.id]
2d607d
@@ -132,7 +139,7 @@ class TestRHELBrandInstaller(BaseBrandFixture):
2d607d
 
2d607d
         self.assertFalse(self.mock_install.called)
2d607d
 
2d607d
-    def test_no_os_on_product(self):
2d607d
+    def test_no_brand_type_on_product(self):
2d607d
         # no .os
2d607d
         stub_product = StubProduct(id=123, name="Awesome OS Super")
2d607d
 
2d607d
@@ -150,7 +157,7 @@ class TestRHELBrandInstaller(BaseBrandFixture):
2d607d
 
2d607d
         self.assertFalse(self.mock_install.called)
2d607d
 
2d607d
-    def test_no_name_on_product(self):
2d607d
+    def test_brand_type_no_name_no_brand_name_on_product(self):
2d607d
         stub_product = StubProduct(id=123, brand_type='OS')
2d607d
         stub_product.name = None
2d607d
 
2d607d
@@ -166,10 +173,95 @@ class TestRHELBrandInstaller(BaseBrandFixture):
2d607d
 
2d607d
         self.assertFalse(self.mock_install.called)
2d607d
 
2d607d
+    def test_no_brand_name_on_product(self):
2d607d
+        stub_product = StubProduct(id=123, name="An Awesome OS", brand_type='OS')
2d607d
+        stub_product.name = None
2d607d
+
2d607d
+        mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
+        mock_prod_dir.get_installed_products.return_value = [stub_product.id]
2d607d
+
2d607d
+        mock_ent_cert = mock.Mock(name='MockEntCert')
2d607d
+        mock_ent_cert.products = [stub_product]
2d607d
+        self._inj_mock_entdir([mock_ent_cert])
2d607d
+
2d607d
+        brand_installer = self.brand_installer_class()
2d607d
+        brand_installer.install()
2d607d
+
2d607d
+        self.assertFalse(self.mock_install.called)
2d607d
+
2d607d
+    def test_no_brand_type_no_brand_name_on_product(self):
2d607d
+        stub_product = StubProduct(id=123, name="An Awesome OS")
2d607d
+        stub_product.name = None
2d607d
+
2d607d
+        mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
+        mock_prod_dir.get_installed_products.return_value = [stub_product.id]
2d607d
+
2d607d
+        mock_ent_cert = mock.Mock(name='MockEntCert')
2d607d
+        mock_ent_cert.products = [stub_product]
2d607d
+        self._inj_mock_entdir([mock_ent_cert])
2d607d
+
2d607d
+        brand_installer = self.brand_installer_class()
2d607d
+        brand_installer.install()
2d607d
+
2d607d
+        self.assertFalse(self.mock_install.called)
2d607d
+
2d607d
+    def test_no_brand_type_brand_name_on_product(self):
2d607d
+        stub_product = StubProduct(id=123, name="An Awesome OS",
2d607d
+                                   brand_name="Branded Awesome OS")
2d607d
+        stub_product.name = None
2d607d
+
2d607d
+        mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
+        mock_prod_dir.get_installed_products.return_value = [stub_product.id]
2d607d
+
2d607d
+        mock_ent_cert = mock.Mock(name='MockEntCert')
2d607d
+        mock_ent_cert.products = [stub_product]
2d607d
+        self._inj_mock_entdir([mock_ent_cert])
2d607d
+
2d607d
+        brand_installer = self.brand_installer_class()
2d607d
+        brand_installer.install()
2d607d
+
2d607d
+        self.assertFalse(self.mock_install.called)
2d607d
+
2d607d
+    def test_wrong_brand_type_brand_name_on_product(self):
2d607d
+        stub_product = StubProduct(id=123, name="An Awesome OS",
2d607d
+                                   brand_type='Middleware',
2d607d
+                                   brand_name="Branded Awesome OS")
2d607d
+        stub_product.name = None
2d607d
+
2d607d
+        mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
+        mock_prod_dir.get_installed_products.return_value = [stub_product.id]
2d607d
+
2d607d
+        mock_ent_cert = mock.Mock(name='MockEntCert')
2d607d
+        mock_ent_cert.products = [stub_product]
2d607d
+        self._inj_mock_entdir([mock_ent_cert])
2d607d
+
2d607d
+        brand_installer = self.brand_installer_class()
2d607d
+        brand_installer.install()
2d607d
+
2d607d
+        self.assertFalse(self.mock_install.called)
2d607d
+
2d607d
+    def test_wrong_brand_type_no_brand_name_on_product(self):
2d607d
+        stub_product = StubProduct(id=123, name="An Awesome OS",
2d607d
+                                   brand_type='Middleware')
2d607d
+        stub_product.name = None
2d607d
+
2d607d
+        mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
+        mock_prod_dir.get_installed_products.return_value = [stub_product.id]
2d607d
+
2d607d
+        mock_ent_cert = mock.Mock(name='MockEntCert')
2d607d
+        mock_ent_cert.products = [stub_product]
2d607d
+        self._inj_mock_entdir([mock_ent_cert])
2d607d
+
2d607d
+        brand_installer = self.brand_installer_class()
2d607d
+        brand_installer.install()
2d607d
+
2d607d
+        self.assertFalse(self.mock_install.called)
2d607d
+
2d607d
     def test_multiple_matching_branded_products(self):
2d607d
         stub_product = DefaultStubProduct()
2d607d
 
2d607d
-        stub_product_2 = StubProduct(id=321, brand_type='OS', name="Slightly Different Awesome OS Super")
2d607d
+        stub_product_2 = StubProduct(id=321, brand_type='OS', name="Awesome",
2d607d
+                                     brand_name="Slightly Different Awesome OS Super")
2d607d
 
2d607d
         mock_prod_dir = mock.NonCallableMock(name='MockProductDir')
2d607d
         mock_prod_dir.get_installed_products.return_value = [stub_product.id, stub_product_2.id]
2d607d
@@ -259,7 +351,7 @@ class TestRhelAndMockBrandsInstaller(TestRHELBrandInstaller):
2d607d
         brand_arg = call_args[0][0]
2d607d
         self.assertTrue(isinstance(brand_arg, entbranding.ProductBrand))
2d607d
         self.assertTrue(isinstance(brand_arg, rhelentbranding.RHELProductBrand))
2d607d
-        self.assertEquals("Awesome OS", brand_arg.name)
2d607d
+        self.assertEquals("Awesome OS super", brand_arg.name)
2d607d
 
2d607d
         # verify the install on all the installers got called
2d607d
         count = 0
2d607d
@@ -322,7 +414,7 @@ class TestRHELBrandPicker(BaseBrandFixture):
2d607d
     def test_more_than_one_ent_cert_with_branding(self, mock_branded_certs):
2d607d
         brand_picker = rhelentbranding.RHELBrandPicker([])
2d607d
         brand = brand_picker.get_brand()
2d607d
-        self.assertEquals("Awesome OS", brand.name)
2d607d
+        self.assertEquals("Awesome OS super", brand.name)
2d607d
 
2d607d
     @mock.patch("subscription_manager.rhelentbranding.RHELBrandPicker._get_branded_cert_products",
2d607d
                 return_value=[])
2d607d
@@ -377,7 +469,9 @@ class TestRHELBrandPicker(BaseBrandFixture):
2d607d
         stub_product = DefaultStubProduct()
2d607d
 
2d607d
         # same product id, different name
2d607d
-        stub_product_2 = StubProduct(id=123, brand_type='OS', name='A Different Stub Product')
2d607d
+        stub_product_2 = StubProduct(id=123, brand_type='OS',
2d607d
+                                     name='A Different Stub Product',
2d607d
+                                     brand_name='A Different branded Stub Product')
2d607d
 
2d607d
         mock_product_dir = mock.NonCallableMock()
2d607d
         # note stub_product.id=123 will match the Product from both ents
2d607d
@@ -478,7 +572,7 @@ class TestRHELBrandPicker(BaseBrandFixture):
2d607d
 
2d607d
         # product.name is none
2d607d
         no_name_stub_product = DefaultStubProduct()
2d607d
-        no_name_stub_product.name = None
2d607d
+        no_name_stub_product.brand_name = None
2d607d
         self.assertFalse(brand_picker._is_rhel_branded_product(no_name_stub_product))
2d607d
 
2d607d
 
2d607d
@@ -505,7 +599,7 @@ class TestProductBrand(BaseBrandFixture):
2d607d
     def test_from_product(self):
2d607d
         stub_product = DefaultStubProduct()
2d607d
         brand = self.brand_class.from_product(stub_product)
2d607d
-        self.assertEquals("Awesome OS", brand.name)
2d607d
+        self.assertEquals(stub_product.brand_name, brand.name)
2d607d
 
2d607d
     def test_format_brand(self):
2d607d
         fb = self.brand_class.format_brand('Blip')