Remove check of deployment type in OS-Faults hook
It looks like deployment does not have `type` attribute anymore: 2018-12-20 11:31:56.827 32486 ERROR rally.task.hook File "/opt/stack/rally-openstack/rally_openstack/hook/fault_injection.py", line 61, in get_cloud_config 2018-12-20 11:31:56.827 32486 ERROR rally.task.hook if deployment_config["type"] != "ExistingCloud": 2018-12-20 11:31:56.827 32486 ERROR rally.task.hook KeyError: 'type' Also correct parent class of FaultInjectionHook to avoid deprecation warning. Change-Id: I2783757386c997a6555e6338aebcda4f9a5f31fa
This commit is contained in:
parent
798caba8e1
commit
2a36f6554e
@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@hook.configure(name="fault_injection", platform="openstack")
|
||||
class FaultInjectionHook(hook.Hook):
|
||||
class FaultInjectionHook(hook.HookAction):
|
||||
"""Performs fault injection using os-faults library.
|
||||
|
||||
Configuration:
|
||||
@ -58,9 +58,6 @@ class FaultInjectionHook(hook.Hook):
|
||||
def get_cloud_config(self):
|
||||
deployment = objects.Deployment.get(self.task["deployment_uuid"])
|
||||
deployment_config = deployment["config"]
|
||||
if deployment_config["type"] != "ExistingCloud":
|
||||
return None
|
||||
|
||||
extra_config = deployment_config.get("extra", {})
|
||||
return extra_config.get("cloud_config")
|
||||
|
||||
|
@ -50,6 +50,7 @@ class FaultInjectionHookTestCase(test.TestCase):
|
||||
@mock.patch("rally.common.objects.Deployment.get")
|
||||
@mock.patch("rally.common.utils.Timer", side_effect=fakes.FakeTimer)
|
||||
def test_run(self, mock_timer, mock_deployment_get):
|
||||
mock_deployment_get.return_value = {"config": {}}
|
||||
hook = fault_injection.FaultInjectionHook(
|
||||
self.task, {"action": "foo", "verify": True},
|
||||
{"iteration": 1})
|
||||
@ -102,6 +103,7 @@ class FaultInjectionHookTestCase(test.TestCase):
|
||||
@mock.patch("rally.common.utils.Timer", side_effect=fakes.FakeTimer)
|
||||
def test_run_error(self, mock_timer, mock_connect, mock_human_api,
|
||||
mock_deployment_get):
|
||||
mock_deployment_get.return_value = {"config": {}}
|
||||
injector_inst = mock_connect.return_value
|
||||
mock_human_api.side_effect = error.OSFException("foo error")
|
||||
hook = fault_injection.FaultInjectionHook(
|
||||
|
Loading…
Reference in New Issue
Block a user