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 <kecarter@redhat.com>
This commit is contained in:
parent
8edbcca6bf
commit
b56a6035fe
@ -69,9 +69,6 @@ class ExportOvercloud(command.Command):
|
|||||||
self.log.debug("take_action(%s)" % parsed_args)
|
self.log.debug("take_action(%s)" % parsed_args)
|
||||||
|
|
||||||
stack = parsed_args.stack
|
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.log.info('Running at %s with parameters %s',
|
||||||
self.now,
|
self.now,
|
||||||
parsed_args)
|
parsed_args)
|
||||||
@ -89,9 +86,17 @@ class ExportOvercloud(command.Command):
|
|||||||
else:
|
else:
|
||||||
config_download_dir = parsed_args.config_download_dir
|
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,
|
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
|
if (os.path.exists(export_file_path) and
|
||||||
not parsed_args.force_overwrite):
|
not parsed_args.force_overwrite):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
@ -104,4 +109,4 @@ class ExportOvercloud(command.Command):
|
|||||||
with open(export_file_path, 'w') as f:
|
with open(export_file_path, 'w') as f:
|
||||||
yaml.safe_dump(data, f, default_flow_style=False)
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user