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.

Conflicts:
      tripleoclient/v1/overcloud_cell.py

Change-Id: I8e2a0922662c0a4d913469fcf2b3180d31512b0f
(cherry picked from commit 4e0465fef8)
(cherry picked from commit 33b4d6b790)
(cherry picked from commit 364d394070)
This commit is contained in:
Rajesh Tailor 2020-11-05 10:39:33 +05:30
parent a79f2b41bd
commit 15050a259e
1 changed files with 13 additions and 5 deletions

View File

@ -21,14 +21,11 @@ from osc_lib.i18n import _
from osc_lib import utils
from tripleoclient import command
from tripleoclient import constants
from tripleoclient import exceptions
from tripleoclient import export
MISTRAL_VAR = os.environ.get('MISTRAL_VAR',
"/var/lib/mistral/")
class ExportCell(command.Command):
"""Export cell information used as import of another cell"""
@ -56,6 +53,11 @@ class ExportCell(command.Command):
parser.add_argument('--output-file', '-o', metavar='<output file>',
help=_('Name of the output file for the cell data '
'export. It will default to "<name>.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.'))
@ -90,7 +92,13 @@ class ExportCell(command.Command):
stack_to_export = cell_stack
should_filter = False
config_download_dir = os.path.join(MISTRAL_VAR, 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))