From b56a6035fe4112d3fe029d0c16da88a7839be327 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 17 May 2022 15:38:39 -0500 Subject: [PATCH] update output path cli switch The output cli switch was being ignored, this change will ensure that if a user provides an output path the export function will operatate as expected. Change-Id: If53fa783c95d9d1031d04763f85278bea7e44b30 Signed-off-by: Kevin Carter --- tripleoclient/v1/overcloud_export.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tripleoclient/v1/overcloud_export.py b/tripleoclient/v1/overcloud_export.py index 6447a5f09..ecadc3c4d 100644 --- a/tripleoclient/v1/overcloud_export.py +++ b/tripleoclient/v1/overcloud_export.py @@ -69,9 +69,6 @@ class ExportOvercloud(command.Command): self.log.debug("take_action(%s)" % parsed_args) stack = parsed_args.stack - output_file = parsed_args.output_file or \ - '%s-export.yaml' % stack - self.log.info('Running at %s with parameters %s', self.now, parsed_args) @@ -89,9 +86,17 @@ class ExportOvercloud(command.Command): else: config_download_dir = parsed_args.config_download_dir - export_file_path = os.path.join( + output_file = parsed_args.output_file or os.path.join( working_dir, - '{}-export.yaml'.format(parsed_args.stack)) + '{}-export.yaml'.format( + parsed_args.stack + ) + ) + export_file_path = os.path.abspath( + os.path.expanduser( + output_file + ) + ) if (os.path.exists(export_file_path) and not parsed_args.force_overwrite): raise Exception( @@ -104,4 +109,4 @@ class ExportOvercloud(command.Command): with open(export_file_path, 'w') as f: yaml.safe_dump(data, f, default_flow_style=False) - print("Stack information exported to %s." % output_file) + print("Stack information exported to %s." % export_file_path)