Add --output-dir

Add an --output-dir cli arg to be used alongside --config-download. The
arg controls where the downloaded ansible playbooks and log files will
be stored on the local filesystem.

The path must be writeable by the current user and mistral user, so it
will typically need to be pre-created manually with the correct
permissions.

Depends-On: I89b17d0c4f035705fd5230caad06d331fd5b5e76
implements: blueprint ansible-config-download

Change-Id: Iff7a1b211a545f1227b9e13e304b858128fb855b
This commit is contained in:
James Slagle 2017-10-24 14:34:45 -04:00
parent c14d21d549
commit 4fa13a9e88
2 changed files with 18 additions and 3 deletions

View File

@ -902,6 +902,16 @@ class DeployOvercloud(command.Command):
default=False,
help=_('Run deployment via config-download mechanism')
)
parser.add_argument(
'--output-dir',
action='store',
default=None,
help=_('Directory to use for saved output when using '
'--config-download. The directory must be '
'writeable by the mistral user. When not '
'specified, the default server side value '
'will be used (/var/lib/mistral/<execution id>.')
)
return parser
def take_action(self, parsed_args):
@ -998,7 +1008,8 @@ class DeployOvercloud(command.Command):
parsed_args.templates,
parsed_args.deployed_server,
parsed_args.overcloud_ssh_user,
parsed_args.overcloud_ssh_key)
parsed_args.overcloud_ssh_key,
parsed_args.output_dir)
# Force fetching of attributes
stack.get()

View File

@ -97,7 +97,7 @@ def overcloudrc(workflow_client, **input_):
def config_download(log, clients, stack, templates, deployed_server,
ssh_user, ssh_key):
ssh_user, ssh_key, output_dir):
role_net_hostname_map = utils.get_role_net_hostname_map(stack)
hostnames = []
for role in role_net_hostname_map:
@ -138,11 +138,15 @@ def config_download(log, clients, stack, templates, deployed_server,
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
workflow_input = {}
if output_dir:
workflow_input.update(dict(work_dir=output_dir))
with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow(
workflow_client,
'tripleo.deployment.v1.config_download_deploy',
workflow_input={}
workflow_input=workflow_input
)
for payload in base.wait_for_messages(workflow_client, ws, execution,