diff options
author | Ryota Mibu <r-mibu@cq.jp.nec.com> | 2018-01-09 13:02:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-01-09 13:02:33 +0000 |
commit | 9fd701278bf7d8c5b9451491bcb1a92580adc780 (patch) | |
tree | 885287d68762c5e755f082c88780b45e056dcc57 /doctor_tests/inspector/congress.py | |
parent | d767217e4ed267c585aa94fbbd3001ec0d59de8c (diff) | |
parent | 754b94bba6df6e7aafd5f1ffb8432a40cb815649 (diff) |
Merge "support pep8 check"
Diffstat (limited to 'doctor_tests/inspector/congress.py')
-rw-r--r-- | doctor_tests/inspector/congress.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/doctor_tests/inspector/congress.py b/doctor_tests/inspector/congress.py index c89a41bd..fb747ec5 100644 --- a/doctor_tests/inspector/congress.py +++ b/doctor_tests/inspector/congress.py @@ -20,13 +20,13 @@ class CongressInspector(BaseInspector): policy = 'classification' rules = { 'host_down': - 'host_down(host) :- doctor:events(hostname=host, type="compute.host.down", status="down")', + 'host_down(host) :- doctor:events(hostname=host, type="compute.host.down", status="down")', # noqa 'active_instance_in_host': - 'active_instance_in_host(vmid, host) :- nova:servers(id=vmid, host_name=host, status="ACTIVE")', + 'active_instance_in_host(vmid, host) :- nova:servers(id=vmid, host_name=host, status="ACTIVE")', # noqa 'host_force_down': - 'execute[nova:services.force_down(host, "nova-compute", "True")] :- host_down(host)', + 'execute[nova:services.force_down(host, "nova-compute", "True")] :- host_down(host)', # noqa 'error_vm_states': - 'execute[nova:servers.reset_state(vmid, "error")] :- host_down(host), active_instance_in_host(vmid, host)' + 'execute[nova:servers.reset_state(vmid, "error")] :- host_down(host), active_instance_in_host(vmid, host)' # noqa } def __init__(self, conf, log): @@ -38,12 +38,14 @@ class CongressInspector(BaseInspector): def _init_driver_and_ds(self): datasources = \ - {ds['name']: ds for ds in self.congress.list_datasources()['results']} + {ds['name']: ds for ds in + self.congress.list_datasources()['results']} # check nova_api version nova_api_version = datasources['nova']['config'].get('api_version') if nova_api_version and nova_api_version < self.nova_api_min_version: - raise Exception('Congress Nova datasource API version < nova_api_min_version(%s)' + raise Exception('Congress Nova datasource API ' + 'version < nova_api_min_version(%s)' % self.nova_api_min_version) # create doctor datasource if it's not exist @@ -54,7 +56,8 @@ class CongressInspector(BaseInspector): # check whether doctor driver exist drivers = \ - {driver['id']: driver for driver in self.congress.list_drivers()['results']} + {driver['id']: driver for driver in + self.congress.list_drivers()['results']} if self.doctor_driver not in drivers: raise Exception('Do not support doctor driver in congress') @@ -66,7 +69,8 @@ class CongressInspector(BaseInspector): ds = self.congress.list_datasources()['results'] doctor_ds = next((item for item in ds if item['driver'] == 'doctor'), None) - congress_endpoint = self.congress.httpclient.get_endpoint(auth=self.auth) + congress_endpoint = \ + self.congress.httpclient.get_endpoint(auth=self.auth) return ('%s/v1/data-sources/%s/tables/events/rows' % (congress_endpoint, doctor_ds['id'])) |