Merge "Add deployment_data to rendered docs"

This commit is contained in:
Zuul
2019-09-18 14:19:10 +00:00
committed by Gerrit Code Review
4 changed files with 19 additions and 6 deletions
+3
View File
@@ -114,3 +114,6 @@ AUTHORS
# Ansible
*.retry
# Linux
~
+4 -4
View File
@@ -55,7 +55,7 @@ def _collect_to_stdout(site_name):
click.echo("\n".join(line.splitlines()))
add_representer_ordered_dict()
res = yaml.safe_dump(
_get_deployment_data_doc(),
get_deployment_data_doc(),
explicit_start=True,
explicit_end=True,
default_flow_style=False)
@@ -88,7 +88,7 @@ def _collect_to_file(site_name, save_location):
add_representer_ordered_dict()
save_files[curr_site_repo].writelines(
yaml.safe_dump(
_get_deployment_data_doc(),
get_deployment_data_doc(),
default_flow_style=False,
explicit_start=True,
explicit_end=True))
@@ -108,7 +108,7 @@ def collect(site_name, save_location):
def render(site_name, output_stream, validate):
rendered_documents = get_rendered_docs(site_name, validate=validate)
rendered_documents.append(get_deployment_data_doc())
if output_stream:
files.dump_all(
rendered_documents,
@@ -193,7 +193,7 @@ def show(site_name, output_stream):
click.echo(msg)
def _get_deployment_data_doc():
def get_deployment_data_doc():
stanzas = {
files.path_leaf(repo): _get_repo_deployment_data_stanza(repo)
for repo in config.all_repos()
+2 -1
View File
@@ -22,6 +22,7 @@ from shipyard_client.api_client.shipyardclient_context import \
import yaml
from pegleg.engine import exceptions
from pegleg.engine import site
from pegleg.engine.util import files
from pegleg.engine.util.files import add_representer_ordered_dict
from pegleg.engine.util.pegleg_secret_management import PeglegSecretManagement
@@ -76,7 +77,7 @@ class ShipyardHelper(object):
collected_documents = files.collect_files_by_repo(self.site_name)
collection_data = []
collection_data = [site.get_deployment_data_doc()]
LOG.info("Processing %d collection(s)", len(collected_documents))
for idx, document in enumerate(collected_documents):
# Decrypt the documents if encrypted
+10 -1
View File
@@ -20,6 +20,7 @@ import pytest
import yaml
from pegleg.engine import util
from pegleg.engine.site import get_deployment_data_doc
from pegleg.engine.util.shipyard_helper import ShipyardHelper
from pegleg.engine.util.shipyard_helper import ShipyardClient
@@ -151,6 +152,10 @@ def _get_data_as_collection(data):
return yaml.dump_all(collection, Dumper=yaml.SafeDumper)
def _get_deployment_data_as_yaml():
return yaml.safe_dump(get_deployment_data_doc())
def test_shipyard_helper_init_():
""" Tests ShipyardHelper init method """
# Scenario:
@@ -197,7 +202,11 @@ def test_upload_documents(*args):
# Validate Shipyard call to post configdocs was invoked with correct
# collection name and buffer mode.
expected_data = _get_data_as_collection(MULTI_REPO_DATA)
expected_data = '---\n'.join(
[
_get_deployment_data_as_yaml(),
_get_data_as_collection(MULTI_REPO_DATA)
])
mock_api_client.post_configdocs.assert_called_with(
collection_id='test-site',
buffer_mode='replace',