Remove usage of parameter enforce_type
Oslo.config deprecated parameter enforce_type and change its default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0. Remove the usage of it to avoid DeprecationWarning: "Using the 'enforce_type' argument is deprecated in version '4.0' and will be removed in version '5.0': The argument enforce_type has changed its default value to True and then will be removed completely." Change-Id: I0f0fb540c43edde64e489915c5199da40a0da9c1 Related--Bug: #1517839
This commit is contained in:
parent
ae8a5fc731
commit
30e0da15ea
@ -180,7 +180,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
||||
@mock.patch.object(hardware, 'dispatch_to_managers', autospec=True)
|
||||
@mock.patch('wsgiref.simple_server.make_server', autospec=True)
|
||||
def test_run(self, mock_make_server, mock_dispatch, mock_wait):
|
||||
CONF.set_override('inspection_callback_url', '', enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', '')
|
||||
wsgi_server = mock_make_server.return_value
|
||||
wsgi_server.start.side_effect = KeyboardInterrupt()
|
||||
|
||||
@ -219,8 +219,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
||||
autospec=True)
|
||||
def test_run_with_inspection(self, mock_list_hardware, mock_make_server,
|
||||
mock_dispatch, mock_inspector, mock_wait):
|
||||
CONF.set_override('inspection_callback_url', 'http://foo/bar',
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', 'http://foo/bar')
|
||||
|
||||
wsgi_server = mock_make_server.return_value
|
||||
wsgi_server.start.side_effect = KeyboardInterrupt()
|
||||
@ -277,8 +276,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
||||
# agent starts, ensure that the inspection will be called and wsgi
|
||||
# server will work as usual. Also, make sure api_client and heartbeater
|
||||
# will not be initialized in this case.
|
||||
CONF.set_override('inspection_callback_url', 'http://foo/bar',
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', 'http://foo/bar')
|
||||
|
||||
self.agent = agent.IronicPythonAgent(None,
|
||||
agent.Host('203.0.113.1', 9990),
|
||||
@ -330,8 +328,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
||||
# the agent starts, ensure that the inspection will be skipped and wsgi
|
||||
# server will work as usual. Also, make sure api_client and heartbeater
|
||||
# will not be initialized in this case.
|
||||
CONF.set_override('inspection_callback_url', None,
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', None)
|
||||
|
||||
self.agent = agent.IronicPythonAgent(None,
|
||||
agent.Host('203.0.113.1', 9990),
|
||||
@ -393,7 +390,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest):
|
||||
@mock.patch('wsgiref.simple_server.make_server', autospec=True)
|
||||
def test_run_with_sleep(self, mock_make_server, mock_dispatch,
|
||||
mock_load_managers, mock_sleep, mock_wait):
|
||||
CONF.set_override('inspection_callback_url', '', enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', '')
|
||||
wsgi_server = mock_make_server.return_value
|
||||
wsgi_server.start.side_effect = KeyboardInterrupt()
|
||||
|
||||
|
@ -1633,7 +1633,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
||||
def test_evaluate_hw_waits_for_disks_configured(self, mocked_root_dev,
|
||||
mocked_sleep,
|
||||
mocked_block_dev):
|
||||
CONF.set_override('disk_wait_attempts', '2', enforce_type=True)
|
||||
CONF.set_override('disk_wait_attempts', '2')
|
||||
|
||||
mocked_root_dev.side_effect = [
|
||||
errors.DeviceNotFound('boom'),
|
||||
@ -1670,7 +1670,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
||||
def test_evaluate_hw_disks_timeout_configured(self, mocked_root_dev,
|
||||
mocked_sleep,
|
||||
mocked_block_dev):
|
||||
CONF.set_override('disk_wait_delay', '5', enforce_type=True)
|
||||
CONF.set_override('disk_wait_delay', '5')
|
||||
mocked_root_dev.side_effect = errors.DeviceNotFound('boom')
|
||||
|
||||
self.hardware.evaluate_hardware_support()
|
||||
|
@ -65,9 +65,8 @@ class TestMisc(base.IronicAgentTest):
|
||||
class TestInspect(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestInspect, self).setUp()
|
||||
CONF.set_override('inspection_callback_url', 'http://foo/bar',
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_collectors', '', enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', 'http://foo/bar')
|
||||
CONF.set_override('inspection_collectors', '')
|
||||
self.mock_collect = AcceptingFailure()
|
||||
self.mock_ext = mock.Mock(spec=['plugin', 'name'],
|
||||
plugin=self.mock_collect)
|
||||
@ -84,8 +83,7 @@ class TestInspect(base.IronicAgentTest):
|
||||
mock_setup_ipmi.assert_called_once_with(mock_call.return_value)
|
||||
|
||||
def test_collectors_option(self, mock_ext_mgr, mock_call, mock_setup_ipmi):
|
||||
CONF.set_override('inspection_collectors', 'foo,bar',
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_collectors', 'foo,bar')
|
||||
mock_ext_mgr.return_value = [
|
||||
mock.Mock(spec=['name', 'plugin'], plugin=AcceptingFailure()),
|
||||
mock.Mock(spec=['name', 'plugin'], plugin=AcceptingFailure()),
|
||||
@ -109,8 +107,7 @@ class TestInspect(base.IronicAgentTest):
|
||||
self.assertFalse(mock_setup_ipmi.called)
|
||||
|
||||
def test_extensions_failed(self, mock_ext_mgr, mock_call, mock_setup_ipmi):
|
||||
CONF.set_override('inspection_collectors', 'foo,bar',
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_collectors', 'foo,bar')
|
||||
mock_ext_mgr.side_effect = RuntimeError('boom')
|
||||
|
||||
self.assertRaisesRegex(RuntimeError, 'boom', inspector.inspect)
|
||||
@ -134,8 +131,7 @@ class TestInspect(base.IronicAgentTest):
|
||||
class TestCallInspector(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestCallInspector, self).setUp()
|
||||
CONF.set_override('inspection_callback_url', 'url',
|
||||
enforce_type=True)
|
||||
CONF.set_override('inspection_callback_url', 'url')
|
||||
|
||||
def test_ok(self, mock_post):
|
||||
failures = utils.AccumulatedFailures()
|
||||
|
Loading…
Reference in New Issue
Block a user