From bcafdf7114903e26c4c02a44c09bfbac53574d69 Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Mon, 24 Oct 2022 23:10:24 +0100 Subject: [PATCH] Fix overcloud cell export paths This was silently failing with the warning: File /home/stack/overcloud-deploy/overcloud/config-download/overcloud/overcloud/group_vars/overcloud.json was not found during export No data returned to export AllNodesExtraMapData from. Since the stack name was appended to config_download_dir twice. Also the working_dir, if given, was ignored when exporting passwords and the default config_download_dir was based on the working_dir instead of the documented default. Change-Id: I77442878a6cc0fb7fb2bae71b888678099466300 --- tripleoclient/tests/v1/test_overcloud_cell.py | 13 +++++++------ tripleoclient/v1/overcloud_cell.py | 15 +++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tripleoclient/tests/v1/test_overcloud_cell.py b/tripleoclient/tests/v1/test_overcloud_cell.py index 099e51803..dda6c3fda 100644 --- a/tripleoclient/tests/v1/test_overcloud_cell.py +++ b/tripleoclient/tests/v1/test_overcloud_cell.py @@ -57,9 +57,10 @@ class TestExportCell(utils.TestCommand): 'overcloud', True, os.path.join( - oooutils.get_default_working_dir('overcloud'), - 'config-download', - 'overcloud')) + os.environ.get('HOME'), + 'overcloud-deploy', + 'overcloud', + 'config-download')) mock_print.assert_called() mock_open.assert_called_once_with('overcloud-cell-export.yaml', 'w') mock_yaml_dump.assert_called_once() @@ -92,13 +93,13 @@ 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( - oooutils.get_default_working_dir('overcloud'), - 'overcloud') + oooutils.get_default_working_dir('fizz'), + 'fizz') mock_export_stack.assert_called_once_with( oooutils.get_default_working_dir('fizz'), 'fizz', False, - os.path.join('buzz', 'fizz')) + 'buzz') mock_print.assert_called() mock_open.assert_called_once_with('fizz-cell-export.yaml', 'w') mock_yaml_dump.assert_called_once() diff --git a/tripleoclient/v1/overcloud_cell.py b/tripleoclient/v1/overcloud_cell.py index e10300380..b20ca63e6 100644 --- a/tripleoclient/v1/overcloud_cell.py +++ b/tripleoclient/v1/overcloud_cell.py @@ -82,10 +82,6 @@ class ExportCell(command.Command): raise exceptions.CellExportError( "File '%s' already exists, not exporting." % output_file) - data = export.export_passwords( - oooutils.get_default_working_dir(control_plane_stack), - control_plane_stack) - stack_to_export = control_plane_stack should_filter = True if cell_stack: @@ -98,14 +94,17 @@ class ExportCell(command.Command): working_dir = parsed_args.working_dir if not parsed_args.config_download_dir: - download_dir = os.path.join(working_dir, 'config-download') + config_download_dir = os.path.join(os.environ.get('HOME'), + "overcloud-deploy", + stack_to_export, + 'config-download') else: - download_dir = parsed_args.config_download_dir + config_download_dir = parsed_args.config_download_dir - config_download_dir = os.path.join(download_dir, stack_to_export) + data = export.export_passwords(working_dir, stack_to_export) data.update(export.export_stack( - oooutils.get_default_working_dir(stack_to_export), + working_dir, stack_to_export, should_filter, config_download_dir)) data = dict(parameter_defaults=data)