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