Merge "Prepare call, add --modify-role and --modify-vars"
This commit is contained in:
commit
81a123bdf7
@ -139,7 +139,10 @@ class TestContainerImagePrepare(TestPluginV1):
|
||||
pull_source=None,
|
||||
push_destination=None,
|
||||
service_filter=None,
|
||||
tag_from_label=None
|
||||
tag_from_label=None,
|
||||
modify_role=None,
|
||||
modify_vars=None,
|
||||
append_tag=None,
|
||||
)
|
||||
|
||||
@mock.patch('tripleo_common.image.kolla_builder.'
|
||||
@ -163,6 +166,9 @@ class TestContainerImagePrepare(TestPluginV1):
|
||||
roles_file = os.path.join(temp, 'roles_data.yaml')
|
||||
with open(roles_file, 'w') as f:
|
||||
f.write(self.roles_yaml)
|
||||
modify_vars_file = os.path.join(temp, 'modify_vars.yaml')
|
||||
with open(modify_vars_file, 'w') as f:
|
||||
f.write('foo: bar')
|
||||
mock_get.side_effect = requests.exceptions.SSLError('ouch')
|
||||
mock_bsf.return_value = set(['OS::TripleO::Services::AodhEvaluator'])
|
||||
|
||||
@ -196,7 +202,11 @@ class TestContainerImagePrepare(TestPluginV1):
|
||||
'-e',
|
||||
'environment/docker.yaml',
|
||||
'--roles-file',
|
||||
roles_file
|
||||
roles_file,
|
||||
'--modify-role',
|
||||
'foo-role',
|
||||
'--modify-vars',
|
||||
modify_vars_file
|
||||
]
|
||||
self.cmd.app.command_options = arglist
|
||||
verifylist = []
|
||||
@ -240,7 +250,10 @@ class TestContainerImagePrepare(TestPluginV1):
|
||||
service_filter=set([
|
||||
'OS::TripleO::Services::AodhEvaluator',
|
||||
]),
|
||||
tag_from_label=None
|
||||
tag_from_label=None,
|
||||
modify_role='foo-role',
|
||||
modify_vars={'foo': 'bar'},
|
||||
append_tag=mock.ANY,
|
||||
)
|
||||
ci_data = {
|
||||
'container_images': [{
|
||||
|
@ -19,6 +19,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from heatclient.common import template_utils
|
||||
from heatclient.common import utils as heat_utils
|
||||
@ -321,6 +322,18 @@ class PrepareImageFiles(command.Command):
|
||||
help=_('Roles file, overrides the default %s'
|
||||
) % constants.OVERCLOUD_ROLES_FILE
|
||||
)
|
||||
parser.add_argument(
|
||||
'--modify-role',
|
||||
dest='modify_role',
|
||||
help=_('Name of ansible role to run between every image upload '
|
||||
'pull and push.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--modify-vars',
|
||||
dest='modify_vars',
|
||||
help=_('Ansible variable file containing variables to use when '
|
||||
'invoking the role --modify-role.')
|
||||
)
|
||||
return parser
|
||||
|
||||
def parse_set_values(self, subs, set_values):
|
||||
@ -391,6 +404,14 @@ class PrepareImageFiles(command.Command):
|
||||
|
||||
output_images_file = (parsed_args.output_images_file
|
||||
or 'container_images.yaml')
|
||||
modify_role = None
|
||||
modify_vars = None
|
||||
append_tag = None
|
||||
if parsed_args.modify_role:
|
||||
modify_role = parsed_args.modify_role
|
||||
append_tag = time.strftime('-modified-%Y%m%d%H%M%S')
|
||||
if parsed_args.modify_vars:
|
||||
modify_vars = yaml.safe_load(open(parsed_args.modify_vars).read())
|
||||
|
||||
prepare_data = kolla_builder.container_images_prepare(
|
||||
excludes=parsed_args.excludes,
|
||||
@ -401,6 +422,9 @@ class PrepareImageFiles(command.Command):
|
||||
output_env_file=parsed_args.output_env_file,
|
||||
output_images_file=output_images_file,
|
||||
tag_from_label=parsed_args.tag_from_label,
|
||||
modify_role=modify_role,
|
||||
modify_vars=modify_vars,
|
||||
append_tag=append_tag
|
||||
)
|
||||
if parsed_args.output_env_file:
|
||||
params = prepare_data[parsed_args.output_env_file]
|
||||
|
Loading…
Reference in New Issue
Block a user