diff -Nru python-glanceclient-0.15.0/debian/changelog python-glanceclient-0.15.0/debian/changelog --- python-glanceclient-0.15.0/debian/changelog 2014-12-19 14:04:53.000000000 +0000 +++ python-glanceclient-0.15.0/debian/changelog 2016-10-05 04:45:52.000000000 +0000 @@ -1,3 +1,10 @@ +python-glanceclient (1:0.15.0-0ubuntu1~cloud1) trusty-kilo; urgency=medium + + * Expose is base schema property attribute (LP: #1323660) + - d/p/Expose_is_base_schema_property_attribute.patch + + -- Seyeong Kim Wed, 05 Oct 2016 04:29:31 +0000 + python-glanceclient (1:0.15.0-0ubuntu1~cloud0) trusty-kilo; urgency=medium * New upstream release for the Ubuntu Cloud Archive. diff -Nru python-glanceclient-0.15.0/debian/patches/Expose_is_base_schema_property_attribute.patch python-glanceclient-0.15.0/debian/patches/Expose_is_base_schema_property_attribute.patch --- python-glanceclient-0.15.0/debian/patches/Expose_is_base_schema_property_attribute.patch 1970-01-01 00:00:00.000000000 +0000 +++ python-glanceclient-0.15.0/debian/patches/Expose_is_base_schema_property_attribute.patch 2016-10-05 04:29:18.000000000 +0000 @@ -0,0 +1,101 @@ +From 90407d9e473014c24eeab294192f9d3208f58ea7 Mon Sep 17 00:00:00 2001 +From: Alexander Tivelkov +Date: Fri, 27 Mar 2015 17:53:46 +0300 +Subject: [PATCH] Expose 'is_base' schema property attribute + +Changeset I49255255 has added an 'is_base' attribute for Image Schema +properties, thus allowing to differentiate between base and custom image +properties, but the client hasn't make any use of it. + +This patch adds appropriate attribute to SchemaProperty class and a +helper method which allows to validate if the given property is base or +not. + +The added helper method (is_base_property) should not be confused with +the existing is_core_property: the latter just checks if the property is +known to the schema, regardless of its being base or not. + +Change-Id: I7c397196dad9ae5494ed2f8f3aacef3fc1ce70d8 +Partial-Bug: #1323660 +--- + glanceclient/v2/schemas.py | 21 ++++++++++++++++++++- + tests/v2/test_schemas.py | 18 ++++++++++++++++++ + 2 files changed, 38 insertions(+), 1 deletion(-) + +Index: python-glanceclient-0.15.0/glanceclient/v2/schemas.py +=================================================================== +--- python-glanceclient-0.15.0.orig/glanceclient/v2/schemas.py 2016-10-05 04:29:14.425292003 +0000 ++++ python-glanceclient-0.15.0/glanceclient/v2/schemas.py 2016-10-05 04:29:14.425292003 +0000 +@@ -47,6 +47,7 @@ + def __init__(self, name, **kwargs): + self.name = name + self.description = kwargs.get('description') ++ self.is_base = kwargs.get('is_base', True) + + + def translate_schema_properties(schema_properties): +@@ -68,9 +69,27 @@ + self.properties = translate_schema_properties(raw_properties) + + def is_core_property(self, property_name): ++ """Checks if a property with a given name is known to the schema, ++ i.e. is either a base property or a custom one registered in ++ schema-image.json file ++ ++ :param property_name: name of the property ++ :returns: True if the property is known, False otherwise ++ """ ++ return self._check_property(property_name, True) ++ ++ def is_base_property(self, property_name): ++ """Checks if a property with a given name is a base property ++ ++ :param property_name: name of the property ++ :returns: True if the property is base, False otherwise ++ """ ++ return self._check_property(property_name, False) ++ ++ def _check_property(self, property_name, allow_non_base): + for prop in self.properties: + if property_name == prop.name: +- return True ++ return prop.is_base or allow_non_base + return False + + def raw(self): +Index: python-glanceclient-0.15.0/tests/v2/test_schemas.py +=================================================================== +--- python-glanceclient-0.15.0.orig/tests/v2/test_schemas.py 2016-10-05 04:29:14.425292003 +0000 ++++ python-glanceclient-0.15.0/tests/v2/test_schemas.py 2016-10-05 04:29:14.425292003 +0000 +@@ -70,6 +70,14 @@ + self.assertEqual('size', prop.name) + self.assertEqual('some quantity', prop.description) + ++ def test_property_is_base(self): ++ prop1 = schemas.SchemaProperty('name') ++ prop2 = schemas.SchemaProperty('foo', is_base=False) ++ prop3 = schemas.SchemaProperty('foo', is_base=True) ++ self.assertTrue(prop1.is_base) ++ self.assertFalse(prop2.is_base) ++ self.assertTrue(prop3.is_base) ++ + + class TestSchema(testtools.TestCase): + def test_schema_minimum(self): +@@ -89,6 +97,16 @@ + schema = schemas.Schema(raw_schema) + self.assertEqual(raw_schema, schema.raw()) + ++ def test_property_is_base(self): ++ raw_schema = {'name': 'Country', ++ 'properties': { ++ 'size': {}, ++ 'population': {'is_base': False}}} ++ schema = schemas.Schema(raw_schema) ++ self.assertTrue(schema.is_base_property('size')) ++ self.assertFalse(schema.is_base_property('population')) ++ self.assertFalse(schema.is_base_property('foo')) ++ + + class TestController(testtools.TestCase): + def setUp(self): diff -Nru python-glanceclient-0.15.0/debian/patches/series python-glanceclient-0.15.0/debian/patches/series --- python-glanceclient-0.15.0/debian/patches/series 2014-12-19 12:53:42.000000000 +0000 +++ python-glanceclient-0.15.0/debian/patches/series 2016-10-05 04:29:12.000000000 +0000 @@ -1,2 +1,3 @@ fix-glanceclient-tests.patch pep-0476.patch +Expose_is_base_schema_property_attribute.patch