Skip layering for control documents

This is to skip layering for control documents (those whose
metadata.schema starts with "deckhand/Control") as these documents
consist of ValidationPolicy or LayeringPolicy documents -- and
it would be both nonsensical and scary to try to layer
these types of documents.

Documentation for this will be updated during a larger overhaul
effort to improve Deckhand's documentation.

Change-Id: Ia785e54c4e26a4158b6bdc89da8b96b4455f7b39
This commit is contained in:
Felipe Monteiro 2018-03-21 20:45:14 +00:00
parent a691f9a47f
commit d20f4741c5
2 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,10 @@ class DocumentDict(dict):
return utils.jsonpath_parse(
self, 'metadata.layeringDefinition.abstract') is True
@property
def is_control(self):
return self.metadata.get('schema', '').startswith('deckhand/Control')
@property
def schema(self):
return self.get('schema') or ''

View File

@ -469,6 +469,9 @@ class DocumentLayering(object):
in both the parent and child documents being layered together.
"""
for doc in self._sorted_documents:
# Control documents don't need to be layered.
if doc.is_control:
continue
if doc.parent_selector:
parent_meta = self._parents.get((doc.schema, doc.name))