From df5e61589f305bc0f7d214afb75abbbcf6a2fd55 Mon Sep 17 00:00:00 2001 From: Brendan Shephard Date: Fri, 17 Jun 2022 12:57:08 +1000 Subject: [PATCH] Remove overcloud config download command The config download command no longer works with ephemeral Heat. We can already achieve the same functionality using overcloud deploy with the --stack-only flag. As such, this change is removing the no longer functional config download command. Change-Id: Ieb52658aaf9ebff95cec1dd80eaf2556e75eef8c --- ...fig-download-command-1427d6609412e3e3.yaml | 7 ++ setup.cfg | 1 - .../overcloud_config/test_overcloud_config.py | 64 ------------- tripleoclient/v1/overcloud_config.py | 91 ------------------- 4 files changed, 7 insertions(+), 156 deletions(-) create mode 100644 releasenotes/notes/remove-config-download-command-1427d6609412e3e3.yaml delete mode 100644 tripleoclient/tests/v1/overcloud_config/test_overcloud_config.py delete mode 100644 tripleoclient/v1/overcloud_config.py diff --git a/releasenotes/notes/remove-config-download-command-1427d6609412e3e3.yaml b/releasenotes/notes/remove-config-download-command-1427d6609412e3e3.yaml new file mode 100644 index 000000000..c70614a57 --- /dev/null +++ b/releasenotes/notes/remove-config-download-command-1427d6609412e3e3.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + The overcloud config download command no longer works with Ephemeral Heat. + We already have the ability to do the same thing using overcloud deploy using + the --stack-only flag. As such, the overcloud config download command is being + removed. diff --git a/setup.cfg b/setup.cfg index 69e1ce346..b9d7fc831 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,7 +46,6 @@ openstack.tripleoclient.v2 = overcloud_ceph_spec = tripleoclient.v2.overcloud_ceph:OvercloudCephSpec overcloud_ceph_user_disable = tripleoclient.v2.overcloud_ceph:OvercloudCephUserDisable overcloud_ceph_user_enable = tripleoclient.v2.overcloud_ceph:OvercloudCephUserEnable - overcloud_config_download = tripleoclient.v1.overcloud_config:DownloadConfig overcloud_delete = tripleoclient.v2.overcloud_delete:DeleteOvercloud overcloud_credentials = tripleoclient.v1.overcloud_credentials:OvercloudCredentials overcloud_deploy = tripleoclient.v1.overcloud_deploy:DeployOvercloud diff --git a/tripleoclient/tests/v1/overcloud_config/test_overcloud_config.py b/tripleoclient/tests/v1/overcloud_config/test_overcloud_config.py deleted file mode 100644 index 1ba872bd9..000000000 --- a/tripleoclient/tests/v1/overcloud_config/test_overcloud_config.py +++ /dev/null @@ -1,64 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from unittest import mock - -from osc_lib.tests import utils - -from tripleoclient.tests import fakes -from tripleoclient.v1 import overcloud_config - - -class TestOvercloudConfig(utils.TestCommand): - - def setUp(self): - super(TestOvercloudConfig, self).setUp() - self.cmd = overcloud_config.DownloadConfig(self.app, None) - self.app.client_manager.orchestration = mock.Mock() - self.app.options = fakes.FakeOptions() - - @mock.patch("tripleoclient.utils.run_ansible_playbook", autospec=True) - def test_overcloud_download_config(self, mock_playbook): - arglist = ['--name', 'overcloud', '--config-dir', '/tmp'] - verifylist = [ - ('name', 'overcloud'), - ('config_dir', '/tmp'), - ('preserve_config_dir', True) - ] - - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.cmd.take_action(parsed_args) - mock_playbook.assert_called_once_with( - extra_vars={'plan': 'overcloud', 'config_dir': '/tmp', - 'preserve_config': True}, - inventory='localhost,', playbook='cli-config-download-export.yaml', - playbook_dir='/usr/share/ansible/tripleo-playbooks', - verbosity=3, workdir=mock.ANY) - - @mock.patch("tripleoclient.utils.run_ansible_playbook", autospec=True) - def test_overcloud_download_config_no_preserve(self, mock_playbook): - arglist = ['--name', 'overcloud', '--config-dir', '/tmp', - '--no-preserve-config'] - verifylist = [ - ('name', 'overcloud'), - ('config_dir', '/tmp'), - ('preserve_config_dir', False) - ] - - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.cmd.take_action(parsed_args) - mock_playbook.assert_called_once_with( - extra_vars={'plan': 'overcloud', 'config_dir': '/tmp', - 'preserve_config': False}, - inventory='localhost,', playbook='cli-config-download-export.yaml', - playbook_dir='/usr/share/ansible/tripleo-playbooks', - verbosity=3, workdir=mock.ANY) diff --git a/tripleoclient/v1/overcloud_config.py b/tripleoclient/v1/overcloud_config.py deleted file mode 100644 index ec91c76fa..000000000 --- a/tripleoclient/v1/overcloud_config.py +++ /dev/null @@ -1,91 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import logging -import os - -from osc_lib.i18n import _ - -from tripleoclient import command -from tripleoclient import constants -from tripleoclient import utils - - -class DownloadConfig(command.Command): - """Download Overcloud Config""" - - log = logging.getLogger(__name__ + ".DownloadConfig") - - def get_parser(self, prog_name): - parser = super(DownloadConfig, self).get_parser(prog_name) - parser.add_argument( - '--name', - dest='name', - default='overcloud', - help=_('The name of the plan, which is used for the object ' - 'storage container, workflow environment and orchestration ' - 'stack names.'), - ) - parser.add_argument( - '--config-dir', - dest='config_dir', - default=os.path.join( - constants.CLOUD_HOME_DIR, - 'tripleo-config' - ), - help=_('The directory where the configuration files will be ' - 'pushed'), - ) - parser.add_argument( - '--config-type', - dest='config_type', - type=list, - default=None, - help=_('Type of object config to be extract from the deployment, ' - 'defaults to all keys available'), - ) - parser.add_argument( - '--no-preserve-config', - dest='preserve_config_dir', - action='store_false', - default=True, - help=('If specified, will delete and recreate the --config-dir ' - 'if it already exists. Default is to use the existing dir ' - 'location and overwrite files. Files in --config-dir not ' - 'from the stack will be preserved by default.') - ) - return parser - - def take_action(self, parsed_args): - self.log.debug("take_action(%s)" % parsed_args) - - name = parsed_args.name - config_dir = os.path.abspath(parsed_args.config_dir) - config_type = parsed_args.config_type - preserve_config_dir = parsed_args.preserve_config_dir - extra_vars = {'plan': name, - 'config_dir': config_dir, - 'preserve_config': preserve_config_dir} - if config_type: - extra_vars['config_type'] = config_type - - with utils.TempDirs() as tmp: - utils.run_ansible_playbook( - playbook='cli-config-download-export.yaml', - inventory='localhost,', - workdir=tmp, - playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS, - verbosity=utils.playbook_verbosity(self=self), - extra_vars=extra_vars) - - print("The TripleO configuration has been successfully generated " - "into: {0}".format(config_dir))