diff --git a/tripleoclient/constants.py b/tripleoclient/constants.py index 14b1b77ab..53c8530c9 100644 --- a/tripleoclient/constants.py +++ b/tripleoclient/constants.py @@ -98,8 +98,10 @@ VALIDATIONS_LOG_BASEDIR = '/var/log/validations' DEFAULT_WORK_DIR = '/var/lib/mistral' + +TRIPLEO_STATIC_INVENTORY = 'tripleo-ansible-inventory.yaml' ANSIBLE_INVENTORY = \ - '/var/lib/mistral/overcloud/tripleo-ansible-inventory.yaml' + '/var/lib/mistral/overcloud/{}'.format(TRIPLEO_STATIC_INVENTORY) ANSIBLE_VALIDATION_DIR = ( os.path.join(DEFAULT_VALIDATIONS_LEGACY_BASEDIR, 'playbooks') diff --git a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py index 1f85ab487..a62509a1d 100644 --- a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py +++ b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py @@ -814,7 +814,9 @@ class TestDeployUndercloud(TestPluginV1): @mock.patch('tripleo_common.utils.config.Config', autospec=True) @mock.patch('os.path.join', return_value='/twd/inventory.yaml') - def test_download_ansible_playbooks(self, mock_join, mock_stack_config, + @mock.patch('shutil.copyfile') + def test_download_ansible_playbooks(self, mock_shutil, mock_join, + mock_stack_config, mock_launch_heat, mock_importInv, createdir_mock): diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 7f78f4252..b59e0da07 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -862,6 +862,10 @@ class Deploy(command.Command): } inventory.write_static_inventory(inv_path, extra_vars) + # Move inventory in output_dir in order to be reusable by users: + shutil.copyfile(inv_path, + os.path.join(self.output_dir, + constants.TRIPLEO_STATIC_INVENTORY)) self.log.info(_('** Downloaded {0} ansible to {1} **').format( stack_name, self.tmp_ansible_dir))