Merge "Remove deprecated substitution_sources kwarg"

This commit is contained in:
Zuul 2018-08-02 18:55:36 +00:00 committed by Gerrit Code Review
commit da910c48b2
2 changed files with 12 additions and 25 deletions

View File

@ -19,7 +19,6 @@ import networkx
from networkx.algorithms.cycles import find_cycle from networkx.algorithms.cycles import find_cycle
from networkx.algorithms.dag import topological_sort from networkx.algorithms.dag import topological_sort
from oslo_log import log as logging from oslo_log import log as logging
from oslo_log import versionutils
from oslo_utils import excutils from oslo_utils import excutils
from deckhand.common.document import DocumentDict as dd from deckhand.common.document import DocumentDict as dd
@ -381,8 +380,11 @@ class DocumentLayering(object):
if error_list: if error_list:
raise errors.InvalidDocumentFormat(error_list=error_list) raise errors.InvalidDocumentFormat(error_list=error_list)
def __init__(self, documents, substitution_sources=None, validate=True, def __init__(self,
fail_on_missing_sub_src=True, encryption_sources=None): documents,
validate=True,
fail_on_missing_sub_src=True,
encryption_sources=None):
"""Contructor for ``DocumentLayering``. """Contructor for ``DocumentLayering``.
:param layering_policy: The document with schema :param layering_policy: The document with schema
@ -391,9 +393,6 @@ class DocumentLayering(object):
in accordance with the ``layerOrder`` defined by the in accordance with the ``layerOrder`` defined by the
LayeringPolicy document. LayeringPolicy document.
:type documents: List[dict] :type documents: List[dict]
:param substitution_sources: List of documents that are potential
sources for substitution. Should only include concrete documents.
:type substitution_sources: List[dict]
:param validate: Whether to pre-validate documents using built-in :param validate: Whether to pre-validate documents using built-in
schema validation. Skips over externally registered ``DataSchema`` schema validation. Skips over externally registered ``DataSchema``
documents to avoid false positives. Default is True. documents to avoid false positives. Default is True.
@ -422,9 +421,7 @@ class DocumentLayering(object):
self._sorted_documents = {} self._sorted_documents = {}
self._documents_by_index = {} self._documents_by_index = {}
substitution_sources = substitution_sources or [] # TODO(felipemonteiro): Add a hook for post-validation too.
# TODO(fmontei): Add a hook for post-validation too.
if validate: if validate:
self._pre_validate_documents(documents) self._pre_validate_documents(documents)
@ -476,20 +473,11 @@ class DocumentLayering(object):
self._layer_order = self._get_layering_order(self._layering_policy) self._layer_order = self._get_layering_order(self._layering_policy)
self._calc_all_document_children() self._calc_all_document_children()
if substitution_sources: substitution_sources = self._calc_replacements_and_substitutions(
versionutils.report_deprecated_feature( [
LOG,
"Usage of `substitution_sources` has been deprecated. All "
"concrete documents will be used by default."
)
else:
substitution_sources = [
d for d in self._documents_by_index.values() d for d in self._documents_by_index.values()
if not d.is_abstract if not d.is_abstract
] ])
substitution_sources = self._calc_replacements_and_substitutions(
substitution_sources)
self.secrets_substitution = secrets_manager.SecretsSubstitution( self.secrets_substitution = secrets_manager.SecretsSubstitution(
substitution_sources, substitution_sources,

View File

@ -176,10 +176,9 @@ class SecretsSubstitution(object):
substitution; documents need not be filtered prior to being passed to substitution; documents need not be filtered prior to being passed to
the constructor. the constructor.
:param substitution_sources: (DEPRECATED) List of documents that are :param substitution_sources: List of documents that are potential
potential sources for substitution. Or dict of documents keyed on sources for substitution. Or dict of documents keyed on tuple of
tuple of (schema, metadata.name). Should only include concrete (schema, metadata.name). Should only include concrete documents.
documents.
:type substitution_sources: List[dict] or dict :type substitution_sources: List[dict] or dict
:param bool fail_on_missing_sub_src: Whether to fail on a missing :param bool fail_on_missing_sub_src: Whether to fail on a missing
substitution source. Default is True. substitution source. Default is True.