diff --git a/muranoclient/v1/artifact_packages.py b/muranoclient/v1/artifact_packages.py index acdc66af..cf95f638 100644 --- a/muranoclient/v1/artifact_packages.py +++ b/muranoclient/v1/artifact_packages.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +import collections + from glanceclient import exc as glance_exc import six import yaml @@ -54,6 +56,23 @@ class ArtifactRepo(object): inherits = self._get_local_inheritance(package.classes) + # check for global inheritance + ancestor_queue = collections.deque(inherits.keys()) + while ancestor_queue: + ancestor_name = ancestor_queue.popleft() + child_classes = inherits[ancestor_name] + + ancestors = self.list(class_definitions=ancestor_name) + for ancestor in ancestors: + # check if ancestor inherits anything + ancestor_inherits = \ + ancestor.type_specific_properties.get('inherits', {}) + for name, value in ancestor_inherits.items(): + # check if this is the class we actually inherit + if ancestor_name in value: + ancestor_queue.append(name) + inherits[name] = child_classes + package_draft['inherits'] = inherits keywords = self._keywords_from_display_name( diff --git a/releasenotes/notes/global-inherits-fix-6da007ec44a774f2.yaml b/releasenotes/notes/global-inherits-fix-6da007ec44a774f2.yaml new file mode 100644 index 00000000..62b8e97f --- /dev/null +++ b/releasenotes/notes/global-inherits-fix-6da007ec44a774f2.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Importing a package into glare, now fills 'inherited' field with full + inheritance info (previously it only contained immediate parent classes).