Merge "Update cell export for ephemeral heat"
This commit is contained in:
commit
80612ac58b
@ -15,8 +15,8 @@ from unittest import mock
|
||||
from osc_lib.tests import utils
|
||||
|
||||
from tripleoclient.v1 import overcloud_cell
|
||||
from tripleoclient import constants
|
||||
from tripleoclient.exceptions import CellExportError
|
||||
from tripleoclient import utils as oooutils
|
||||
|
||||
|
||||
class TestExportCell(utils.TestCommand):
|
||||
@ -50,13 +50,16 @@ class TestExportCell(utils.TestCommand):
|
||||
self.cmd.take_action(parsed_args)
|
||||
mock_path_exists.assert_any_call('overcloud-cell-export.yaml')
|
||||
mock_export_passwords.assert_called_once_with(
|
||||
self.app.client_manager.orchestration,
|
||||
oooutils.get_default_working_dir('overcloud'),
|
||||
'overcloud')
|
||||
mock_export_stack.assert_called_once_with(
|
||||
self.app.client_manager.orchestration,
|
||||
oooutils.get_default_working_dir('overcloud'),
|
||||
'overcloud',
|
||||
True,
|
||||
os.path.join(constants.DEFAULT_WORK_DIR, 'overcloud'))
|
||||
os.path.join(
|
||||
oooutils.get_default_working_dir('overcloud'),
|
||||
'config-download',
|
||||
'overcloud'))
|
||||
mock_print.assert_called()
|
||||
mock_open.assert_called_once_with('overcloud-cell-export.yaml', 'w')
|
||||
mock_yaml_dump.assert_called_once()
|
||||
@ -89,10 +92,10 @@ class TestExportCell(utils.TestCommand):
|
||||
self.cmd.take_action(parsed_args)
|
||||
mock_path_exists.assert_any_call('fizz-cell-export.yaml')
|
||||
mock_export_passwords.assert_called_once_with(
|
||||
self.app.client_manager.orchestration,
|
||||
oooutils.get_default_working_dir('overcloud'),
|
||||
'overcloud')
|
||||
mock_export_stack.assert_called_once_with(
|
||||
self.app.client_manager.orchestration,
|
||||
oooutils.get_default_working_dir('fizz'),
|
||||
'fizz',
|
||||
False,
|
||||
os.path.join('buzz', 'fizz'))
|
||||
|
@ -19,9 +19,9 @@ 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
|
||||
from tripleoclient import utils as oooutils
|
||||
|
||||
|
||||
class ExportCell(command.Command):
|
||||
@ -48,11 +48,16 @@ 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('--working-dir', action='store',
|
||||
help=_('The working directory for the '
|
||||
'deployment where all input, output, and '
|
||||
'generated files are stored. Defaults to '
|
||||
'"$HOME/overcloud-deploy/<stack>"'))
|
||||
parser.add_argument('--config-download-dir',
|
||||
action='store',
|
||||
help=_('Directory to search for config-download '
|
||||
'export data. Defaults to '
|
||||
'$HOME/config-download'))
|
||||
'export data. Defaults to $HOME/'
|
||||
'overcloud-deploy/<stack>/config-download'))
|
||||
parser.add_argument('--force-overwrite', '-f', action='store_true',
|
||||
default=False,
|
||||
help=_('Overwrite output file if it exists.'))
|
||||
@ -77,11 +82,9 @@ class ExportCell(command.Command):
|
||||
raise exceptions.CellExportError(
|
||||
"File '%s' already exists, not exporting." % output_file)
|
||||
|
||||
# prepare clients to access the environment
|
||||
clients = self.app.client_manager
|
||||
heat = clients.orchestration
|
||||
|
||||
data = export.export_passwords(heat, control_plane_stack)
|
||||
data = export.export_passwords(
|
||||
oooutils.get_default_working_dir(control_plane_stack),
|
||||
control_plane_stack)
|
||||
|
||||
stack_to_export = control_plane_stack
|
||||
should_filter = True
|
||||
@ -89,15 +92,21 @@ class ExportCell(command.Command):
|
||||
stack_to_export = cell_stack
|
||||
should_filter = False
|
||||
|
||||
if not parsed_args.working_dir:
|
||||
working_dir = oooutils.get_default_working_dir(stack_to_export)
|
||||
else:
|
||||
working_dir = parsed_args.working_dir
|
||||
|
||||
if not parsed_args.config_download_dir:
|
||||
download_dir = constants.DEFAULT_WORK_DIR
|
||||
download_dir = os.path.join(working_dir, 'config-download')
|
||||
else:
|
||||
download_dir = parsed_args.config_download_dir
|
||||
|
||||
config_download_dir = os.path.join(download_dir, stack_to_export)
|
||||
|
||||
data.update(export.export_stack(
|
||||
heat, stack_to_export, should_filter,
|
||||
oooutils.get_default_working_dir(stack_to_export),
|
||||
stack_to_export, should_filter,
|
||||
config_download_dir))
|
||||
data = dict(parameter_defaults=data)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user