From 3e6dfdb3b9305d62211aa460f045450c26720555 Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Fri, 1 May 2020 14:10:34 +0800 Subject: [PATCH] Remove [conductor]api_url It was deprecated long before. Change-Id: I05d8a90dbf6e92ef230b1a9624c6816fc96c6a7f --- ironic/conf/conductor.py | 11 ----------- ironic/drivers/modules/deploy_utils.py | 4 ---- ironic/tests/unit/common/test_pxe_utils.py | 4 ---- .../unit/drivers/modules/test_deploy_utils.py | 17 ++--------------- ironic/tests/unit/drivers/modules/test_ipxe.py | 1 - ironic/tests/unit/drivers/modules/test_pxe.py | 1 - .../notes/del-api-url-eb2ea29aa63a2cb5.yaml | 6 ++++++ 7 files changed, 8 insertions(+), 36 deletions(-) create mode 100644 releasenotes/notes/del-api-url-eb2ea29aa63a2cb5.yaml diff --git a/ironic/conf/conductor.py b/ironic/conf/conductor.py index da98678a6c..1843f74cc6 100644 --- a/ironic/conf/conductor.py +++ b/ironic/conf/conductor.py @@ -30,17 +30,6 @@ opts = [ cfg.IntOpt('heartbeat_interval', default=10, help=_('Seconds between conductor heart beats.')), - cfg.URIOpt('api_url', - schemes=('http', 'https'), - deprecated_for_removal=True, - deprecated_reason=_("Use [service_catalog]endpoint_override " - "option instead if required to use " - "a specific ironic api address, " - "for example in noauth mode."), - help=_('URL of Ironic API service. If not set ironic can ' - 'get the current value from the keystone service ' - 'catalog. If set, the value must start with either ' - 'http:// or https://.')), cfg.IntOpt('heartbeat_timeout', default=60, # We're using timedelta which can overflow if somebody sets this diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index cb0af75c8e..6bc73c0cbd 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -92,10 +92,6 @@ def get_ironic_api_url(): CONF.set_override('auth_type', 'none', group='service_catalog') adapter_opts['auth'] = keystone.get_auth('service_catalog') - # TODO(pas-ha) remove in Rocky - # NOTE(pas-ha) if both set, the new options win - if CONF.conductor.api_url and not CONF.service_catalog.endpoint_override: - adapter_opts['endpoint_override'] = CONF.conductor.api_url try: ironic_api = keystone.get_endpoint('service_catalog', **adapter_opts) except (exception.KeystoneFailure, diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index 6950bfe8a5..5dd660b224 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -1155,8 +1155,6 @@ class PXEBuildConfigOptionsTestCase(db_base.DbTestCase): ramdisk_params=None): self.config(debug=debug) self.config(pxe_append_params='test_param', group='pxe') - # NOTE: right '/' should be removed from url string - self.config(api_url='http://192.168.122.184:6385', group='conductor') driver_internal_info = self.node.driver_internal_info driver_internal_info['is_whole_disk_image'] = whle_dsk_img @@ -1415,8 +1413,6 @@ class iPXEBuildConfigOptionsTestCase(db_base.DbTestCase): mode='deploy'): self.config(debug=debug) self.config(pxe_append_params='test_param', group='pxe') - # NOTE: right '/' should be removed from url string - self.config(api_url='http://192.168.122.184:6385', group='conductor') self.config(ipxe_timeout=ipxe_timeout, group='pxe') root_dir = CONF.deploy.http_root diff --git a/ironic/tests/unit/drivers/modules/test_deploy_utils.py b/ironic/tests/unit/drivers/modules/test_deploy_utils.py index a39b33a351..9594b8d87a 100644 --- a/ironic/tests/unit/drivers/modules/test_deploy_utils.py +++ b/ironic/tests/unit/drivers/modules/test_deploy_utils.py @@ -771,16 +771,6 @@ class OtherFunctionTestCase(db_base.DbTestCase): mock_clean_up_caches.assert_called_once_with(None, 'master_dir', [('uuid', 'path')]) - @mock.patch('ironic.common.keystone.get_auth') - @mock.patch.object(utils, '_get_ironic_session') - def test_get_ironic_api_url_from_config(self, mock_ks, mock_auth): - mock_sess = mock.Mock() - mock_ks.return_value = mock_sess - fake_api_url = 'http://foo/' - self.config(api_url=fake_api_url, group='conductor') - # also checking for stripped trailing slash - self.assertEqual(fake_api_url[:-1], utils.get_ironic_api_url()) - @mock.patch('ironic.common.keystone.get_auth') @mock.patch.object(utils, '_get_ironic_session') @mock.patch('ironic.common.keystone.get_adapter') @@ -791,7 +781,6 @@ class OtherFunctionTestCase(db_base.DbTestCase): fake_api_url = 'http://foo/' mock_ka.return_value.get_endpoint.return_value = fake_api_url # NOTE(pas-ha) endpoint_override is None by default - self.config(api_url=None, group='conductor') url = utils.get_ironic_api_url() # also checking for stripped trailing slash self.assertEqual(fake_api_url[:-1], url) @@ -807,7 +796,6 @@ class OtherFunctionTestCase(db_base.DbTestCase): mock_ks.return_value = mock_sess mock_ka.return_value.get_endpoint.side_effect = ( exception.KeystoneFailure()) - self.config(api_url=None, group='conductor') self.assertRaises(exception.InvalidParameterValue, utils.get_ironic_api_url) @@ -818,7 +806,6 @@ class OtherFunctionTestCase(db_base.DbTestCase): mock_sess = mock.Mock() mock_ks.return_value = mock_sess mock_ka.return_value.get_endpoint.return_value = None - self.config(api_url=None, group='conductor') self.assertRaises(exception.InvalidParameterValue, utils.get_ironic_api_url) @@ -1192,13 +1179,13 @@ class AgentMethodsTestCase(db_base.DbTestCase): self._test_tear_down_inband_cleaning(cleaning_error=True) def test_build_agent_options_conf(self): - self.config(api_url='https://api-url', group='conductor') + self.config(endpoint_override='https://api-url', + group='service_catalog') options = utils.build_agent_options(self.node) self.assertEqual('https://api-url', options['ipa-api-url']) @mock.patch.object(utils, '_get_ironic_session') def test_build_agent_options_keystone(self, session_mock): - self.config(api_url=None, group='conductor') sess = mock.Mock() sess.get_endpoint.return_value = 'https://api-url' session_mock.return_value = sess diff --git a/ironic/tests/unit/drivers/modules/test_ipxe.py b/ironic/tests/unit/drivers/modules/test_ipxe.py index cbec1bb0d7..2e07c78042 100644 --- a/ironic/tests/unit/drivers/modules/test_ipxe.py +++ b/ironic/tests/unit/drivers/modules/test_ipxe.py @@ -83,7 +83,6 @@ class iPXEBootTestCase(db_base.DbTestCase): driver_internal_info=self.driver_internal_info) self.port = obj_utils.create_test_port(self.context, node_id=self.node.id) - self.config(group='conductor', api_url='http://127.0.0.1:1234/') def test_get_properties(self): expected = pxe_base.COMMON_PROPERTIES diff --git a/ironic/tests/unit/drivers/modules/test_pxe.py b/ironic/tests/unit/drivers/modules/test_pxe.py index ed4fa2b63f..5a5542be85 100644 --- a/ironic/tests/unit/drivers/modules/test_pxe.py +++ b/ironic/tests/unit/drivers/modules/test_pxe.py @@ -85,7 +85,6 @@ class PXEBootTestCase(db_base.DbTestCase): driver_internal_info=self.driver_internal_info) self.port = obj_utils.create_test_port(self.context, node_id=self.node.id) - self.config(group='conductor', api_url='http://127.0.0.1:1234/') self.config(my_ipv6='2001:db8::1') def test_get_properties(self): diff --git a/releasenotes/notes/del-api-url-eb2ea29aa63a2cb5.yaml b/releasenotes/notes/del-api-url-eb2ea29aa63a2cb5.yaml new file mode 100644 index 0000000000..517d012ec7 --- /dev/null +++ b/releasenotes/notes/del-api-url-eb2ea29aa63a2cb5.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The ``[conductor]api_url`` was deprecated and removed, use + ``[service_catalog]endpoint_override`` instead if required to use + a specific ironic api url.