From 33b4d6b790fbadeea51e4e83cafafb4a37809236 Mon Sep 17 00:00:00 2001 From: Rajesh Tailor Date: Thu, 5 Nov 2020 10:39:33 +0530 Subject: [PATCH] Add config-download-dir flag to cell export command `overcloud cell export` command does not have option to provide from where to copy export data if config-download data is exported to custom directory. This change add the option for `overcloud cell export` command to provide custom directory. Change-Id: I8e2a0922662c0a4d913469fcf2b3180d31512b0f (cherry picked from commit 4e0465fef8f137566ca1b66795742eaebf5f4c7a) --- tripleoclient/v1/overcloud_cell.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tripleoclient/v1/overcloud_cell.py b/tripleoclient/v1/overcloud_cell.py index 885e9f770..5cb0cf318 100644 --- a/tripleoclient/v1/overcloud_cell.py +++ b/tripleoclient/v1/overcloud_cell.py @@ -51,6 +51,11 @@ class ExportCell(command.Command): parser.add_argument('--output-file', '-o', metavar='', help=_('Name of the output file for the cell data ' 'export. It will default to ".yaml"')) + parser.add_argument('--config-download-dir', + action='store', + help=_('Directory to search for config-download ' + 'export data. Defaults to ' + '$HOME/config-download')) parser.add_argument('--force-overwrite', '-f', action='store_true', default=False, help=_('Overwrite output file if it exists.')) @@ -85,8 +90,13 @@ class ExportCell(command.Command): stack_to_export = cell_stack should_filter = False - config_download_dir = os.path.join(constants.DEFAULT_WORK_DIR, - stack_to_export) + if not parsed_args.config_download_dir: + download_dir = constants.DEFAULT_WORK_DIR + else: + download_dir = parsed_args.config_download_dir + + config_download_dir = os.path.join(download_dir, stack_to_export) + data.update(export.export_stack( clients.orchestration, stack_to_export, should_filter, config_download_dir))