Raise exception on unfound secret in source document

This PS introduces a new exception SubstitutionSourceSecretNotFound
which is raised when a src.path referenced under the substitutions
of a destination document isn't found in the data section of
the corresponding source document if fail_on_missing_sub_src
is True -- else a warning is logged.

Change-Id: If2b08f443cde765a1dbfaf7bac6b549591e59148
This commit is contained in:
Felipe Monteiro
2018-04-05 16:26:11 -04:00
parent 35f15ee601
commit a3d32c3459
6 changed files with 120 additions and 28 deletions

View File

@@ -302,6 +302,26 @@ class RevisionTagBadFormat(DeckhandException):
code = 400
class SubstitutionSourceDataNotFound(DeckhandException):
"""Required substitution source secret was not found in the substitution
source document at the path ``metadata.substitutions.[*].src.path`` in the
destination document.
**Troubleshoot:**
* Ensure that the missing source secret exists at the ``src.path``
specified under the given substitution in the destination document and
that the ``src.path`` itself exists in the source document.
"""
msg_fmt = (
"Required substitution source secret was not found at path "
"%(src_path)s in source document [%(src_schema)s, %(src_layer)s] "
"%(src_name)s which is referenced by destination document "
"[%(dest_schema)s, %(dest_layer)s] %(dest_name)s under its "
"`metadata.substitutions`.")
code = 400
class DocumentNotFound(DeckhandException):
"""The requested document could not be found.
@@ -376,7 +396,7 @@ class LayeringPolicyNotFound(DeckhandException):
class SubstitutionSourceNotFound(DeckhandException):
"""Required substitution source document was not found for layering.
"""Required substitution source document was not found.
**Troubleshoot:**