From 29fe3996bbe8cdaaa86c73cfb3dda443e789bd96 Mon Sep 17 00:00:00 2001 From: John Fulton Date: Tue, 19 Jul 2022 07:21:27 -0400 Subject: [PATCH] Ensure tripleo_ceph_client_vars is set consistently python-tripleoclient knows the correct working directory after baremetal deployment. Thus, it can correctly override the tripleo_ceph_client_vars variable in tripleo-ansible roles. Use /home/USER/overcloud-deploy/STACK/ceph_client.yml, where everything up to ceph_client.yml comes from the utils.py function get_default_working_dir(STACK). When tripleo-ansible roles are called directly by the client use --extra-vars to pass tripleo_ceph_client_vars. As per the deployed_ceph.yaml.j2 template in tripleo-ansible, the Heat parameter CephClientConfigVars will then be set to the same value. Then when the tripleo-ansible roles are called by config-download they will have the same value for tripleo_ceph_client_vars. Update export.py to use same path. Change-Id: I7717f2ce9f668e9fd77c9b49e2433d729ed3c836 Depends-On: I0346bf1c6a3d8796a0aa70cbaac6e34b2f74fabb Closes-Bug: #1981467 --- tripleoclient/export.py | 4 ++-- tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py | 2 ++ tripleoclient/v2/overcloud_ceph.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tripleoclient/export.py b/tripleoclient/export.py index 453dd9279..af7f57612 100644 --- a/tripleoclient/export.py +++ b/tripleoclient/export.py @@ -210,8 +210,8 @@ def export_ceph(stack, cephx, fsid = ceph_data['fsid'] if 'cephadm' in config_download_files: - ceph_client = "cephadm/ceph_client.yml" - file = os.path.join(config_download_dir, stack, ceph_client) + file = os.path.join(oooutils.get_default_working_dir(stack), + 'ceph_client.yml') if not os.path.exists(file): # fall back to old path if user had LP 1978846 during deployment file = "/home/stack/ceph_client.yaml" diff --git a/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py b/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py index e7705d438..0c7171ef2 100644 --- a/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py +++ b/tripleoclient/tests/v2/overcloud_ceph/test_overcloud_ceph.py @@ -67,6 +67,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution): "deployed_ceph_tht_path": mock.ANY, "working_dir": mock.ANY, "stack_name": 'overcloud', + "tripleo_ceph_client_vars": mock.ANY, "tripleo_cephadm_standalone": False, 'tripleo_cephadm_ssh_user': 'jimmy', 'tripleo_cephadm_cluster': 'ceph', @@ -112,6 +113,7 @@ class TestOvercloudCephDeploy(fakes.FakePlaybookExecution): "deployed_ceph_tht_path": mock.ANY, "working_dir": mock.ANY, "stack_name": 'overcloud', + "tripleo_ceph_client_vars": mock.ANY, "tripleo_cephadm_standalone": False, 'tripleo_roles_path': mock.ANY, 'tripleo_cephadm_first_mon_ip': '127.0.0.1', diff --git a/tripleoclient/v2/overcloud_ceph.py b/tripleoclient/v2/overcloud_ceph.py index 4793f6c38..60c59ac76 100644 --- a/tripleoclient/v2/overcloud_ceph.py +++ b/tripleoclient/v2/overcloud_ceph.py @@ -391,7 +391,9 @@ class OvercloudCephDeploy(command.Command): "deployed_ceph_tht_path": output_path, "working_dir": working_dir, "stack_name": parsed_args.stack, - "tripleo_cephadm_standalone": parsed_args.standalone + "tripleo_cephadm_standalone": parsed_args.standalone, + "tripleo_ceph_client_vars": os.path.join(working_dir, + 'ceph_client.yml') } extra_vars_file = None # optional paths to pass to playbook