Fix: Allow generic documents to be used as substitution sources.

This PS fixes a bug related to Deckhand only using "secret"
document types to be used as substitution sources; the substitution
logic should be made generic, because it shouldn't just apply to
secrets.

This entailed removing the "is_secret" database column from the
Document table as it's no longer needed and dropping it from a DB
query made to find the source document for substitution in the
secrets_manager module.

This PS also increased resiliency via exception handling and some
edge cases surrounding substitution.

Finally, unit tests and functional tests were added to validate
substitition using a generic document as the source.

Change-Id: I2c4b49b2eb55473c56b8253a456803e793b0b0b0
This commit is contained in:
Felipe Monteiro
2018-01-03 19:44:20 +00:00
parent 69db7f81fa
commit 4b70927bb2
13 changed files with 212 additions and 51 deletions

View File

@@ -182,20 +182,6 @@ class InvalidDocumentSchema(DeckhandException):
code = 400
class DocumentExists(DeckhandException):
msg_fmt = ("Document with schema %(schema)s and metadata.name "
"%(name)s already exists in bucket %(bucket)s.")
code = 409
class SingletonDocumentConflict(DeckhandException):
msg_fmt = ("A singleton document by the name %(document)s already "
"exists in the system. The new document %(conflict)s cannot be "
"created. To create a document with a new name, delete the "
"current one first.")
code = 409
class IndeterminateDocumentParent(DeckhandException):
msg_fmt = ("Too many parent documents found for document %(document)s.")
code = 400
@@ -204,6 +190,7 @@ class IndeterminateDocumentParent(DeckhandException):
class MissingDocumentKey(DeckhandException):
msg_fmt = ("Missing document key %(key)s from either parent or child. "
"Parent: %(parent)s. Child: %(child)s.")
code = 400
class UnsupportedActionMethod(DeckhandException):
@@ -211,6 +198,12 @@ class UnsupportedActionMethod(DeckhandException):
code = 400
class RevisionTagBadFormat(DeckhandException):
msg_fmt = ("The requested tag data %(data)s must either be null or "
"dictionary.")
code = 400
class DocumentNotFound(DeckhandException):
msg_fmt = ("The requested document %(document)s was not found.")
code = 404
@@ -227,11 +220,6 @@ class RevisionTagNotFound(DeckhandException):
code = 404
class LayeringPolicyNotFound(DeckhandException):
msg_fmt = ("Required LayeringPolicy was not found for layering.")
code = 409
class ValidationNotFound(DeckhandException):
msg_fmt = ("The requested validation entry %(entry_id)s was not found "
"for validation name %(validation_name)s and revision ID "
@@ -239,10 +227,29 @@ class ValidationNotFound(DeckhandException):
code = 404
class RevisionTagBadFormat(DeckhandException):
msg_fmt = ("The requested tag data %(data)s must either be null or "
"dictionary.")
code = 400
class DocumentExists(DeckhandException):
msg_fmt = ("Document with schema %(schema)s and metadata.name "
"%(name)s already exists in bucket %(bucket)s.")
code = 409
class SingletonDocumentConflict(DeckhandException):
msg_fmt = ("A singleton document by the name %(document)s already "
"exists in the system. The new document %(conflict)s cannot be "
"created. To create a document with a new name, delete the "
"current one first.")
code = 409
class LayeringPolicyNotFound(DeckhandException):
msg_fmt = ("Required LayeringPolicy was not found for layering.")
code = 409
class SubstitutionDependencyNotFound(DeckhandException):
msg_fmt = ('Failed to find a dependent source document required for '
'substitution. Details: %(details)s')
code = 409
class BarbicanException(DeckhandException):