Fix pylint errors
Deleted the copy of _get_fake_phys_lease_values function. Added missing whitespaces. Deleted excess tabulations. Change-Id: I30a0b109e2bcfa57e1a0b0ec31557e40a60e50ef Closes-bug: #1255983
This commit is contained in:
parent
34778799f4
commit
8babc9d053
@ -378,18 +378,18 @@ class PhysicalHostPlugin(base.BasePlugin):
|
||||
requirements = json.loads(requirements)
|
||||
# Requirement list looks like ['<', '$ram', '1024']
|
||||
if self._requirements_with_three_elements(requirements):
|
||||
result = []
|
||||
if requirements[0] == '=':
|
||||
requirements[0] = '=='
|
||||
string = (requirements[1][1:] + " " + requirements[0] + " " +
|
||||
requirements[2])
|
||||
result.append(string)
|
||||
return result
|
||||
result = []
|
||||
if requirements[0] == '=':
|
||||
requirements[0] = '=='
|
||||
string = (requirements[1][1:] + " " + requirements[0] + " " +
|
||||
requirements[2])
|
||||
result.append(string)
|
||||
return result
|
||||
# Remove the 'and' element at the head of the requirement list
|
||||
elif self._requirements_with_and_keyword(requirements):
|
||||
return [self._convert_requirements(x)[0]
|
||||
for x in requirements[1:]]
|
||||
# Empty requirement list
|
||||
return [self._convert_requirements(x)[0]
|
||||
for x in requirements[1:]]
|
||||
# Empty requirement list0
|
||||
elif isinstance(requirements, list) and not requirements:
|
||||
return requirements
|
||||
else:
|
||||
|
@ -242,12 +242,12 @@ class ReservationPool(object):
|
||||
except nova_exceptions.ClientException:
|
||||
hosts_failing_to_remove.append(host)
|
||||
if freepool_agg.id != agg.id:
|
||||
# NOTE(sbauza) : We don't want to put again the host in
|
||||
# freepool if the requested pool is the freepool...
|
||||
try:
|
||||
self.nova.aggregates.add_host(freepool_agg.id, host)
|
||||
except nova_exceptions.ClientException:
|
||||
hosts_failing_to_add.append(host)
|
||||
# NOTE(sbauza) : We don't want to put again the host in
|
||||
# freepool if the requested pool is the freepool...
|
||||
try:
|
||||
self.nova.aggregates.add_host(freepool_agg.id, host)
|
||||
except nova_exceptions.ClientException:
|
||||
hosts_failing_to_add.append(host)
|
||||
|
||||
if hosts_failing_to_remove:
|
||||
raise manager_exceptions.CantRemoveHost(
|
||||
|
@ -77,23 +77,6 @@ def _create_physical_lease(values=_get_fake_phys_lease_values(),
|
||||
return lease
|
||||
|
||||
|
||||
def _get_fake_phys_lease_values(id=_get_fake_lease_uuid(),
|
||||
name='fake_phys_lease',
|
||||
start_date=_get_datetime('2030-01-01 00:00'),
|
||||
end_date=_get_datetime('2030-01-02 00:00'),
|
||||
resource_id=None):
|
||||
return {'id': id,
|
||||
'name': name,
|
||||
'start_date': start_date,
|
||||
'end_date': end_date,
|
||||
'trust': 'trust',
|
||||
'reservations': [_get_fake_phys_reservation_values(
|
||||
lease_id=id,
|
||||
resource_id=resource_id)],
|
||||
'events': []
|
||||
}
|
||||
|
||||
|
||||
class SQLAlchemyDBUtilsTestCase(tests.DBTestCase):
|
||||
"""Test case for SQLAlchemy DB utils."""
|
||||
|
||||
|
@ -80,7 +80,7 @@ class ServiceTestCase(tests.TestCase):
|
||||
self.reservation_update = self.patch(self.db_api, 'reservation_update')
|
||||
self.event_update = self.patch(self.db_api, 'event_update')
|
||||
self.manager.plugins = {'virtual:instance': self.fake_plugin}
|
||||
self.manager.resource_actions =\
|
||||
self.manager.resource_actions = \
|
||||
{'virtual:instance':
|
||||
{'on_start': self.fake_plugin.on_start,
|
||||
'on_end': self.fake_plugin.on_end}}
|
||||
|
@ -42,7 +42,7 @@ class VMPluginTestCase(tests.TestCase):
|
||||
|
||||
@testtools.skip('Will be released later')
|
||||
def test_on_start_fail(self):
|
||||
self.client.side_effect =\
|
||||
self.client.side_effect = \
|
||||
self.nova.ClimateNovaClient.exceptions.Conflict
|
||||
|
||||
self.plugin.on_start(self.fake_id)
|
||||
@ -73,7 +73,7 @@ class VMPluginTestCase(tests.TestCase):
|
||||
self.client.return_value.servers.delete.assert_called_once_with('1')
|
||||
|
||||
def test_on_end_instance_deleted(self):
|
||||
self.client.side_effect =\
|
||||
self.client.side_effect = \
|
||||
self.nova.ClimateNovaClient.exceptions.NotFound
|
||||
|
||||
self.assertRaises(self.exc.TaskFailed,
|
||||
|
@ -41,7 +41,7 @@ class FakeNovaHypervisors(object):
|
||||
try:
|
||||
host = int(host)
|
||||
except ValueError:
|
||||
raise nova_exceptions.NotFound(404)
|
||||
raise nova_exceptions.NotFound(404)
|
||||
if host == cls.FakeHost.id:
|
||||
return cls.FakeHost
|
||||
else:
|
||||
@ -52,7 +52,7 @@ class FakeNovaHypervisors(object):
|
||||
if host == 'multiple':
|
||||
return [cls.FakeHost, cls.FakeHost]
|
||||
if host == cls.FakeHost.hypervisor_hostname:
|
||||
return [cls.FakeHost]
|
||||
return [cls.FakeHost]
|
||||
else:
|
||||
raise nova_exceptions.NotFound(404)
|
||||
|
||||
|
@ -33,7 +33,7 @@ class TestBaseStackUtils(tests.TestCase):
|
||||
pass
|
||||
|
||||
def test_url_for_good_v2_public(self):
|
||||
service_catalog =\
|
||||
service_catalog = \
|
||||
[{"endpoints": [{"adminURL": self.url % 'admin',
|
||||
"region": "RegionOne",
|
||||
"internalURL": self.url % 'internal',
|
||||
@ -45,7 +45,7 @@ class TestBaseStackUtils(tests.TestCase):
|
||||
self.assertEqual(url, self.url % 'public')
|
||||
|
||||
def test_url_for_good_v2_admin(self):
|
||||
service_catalog =\
|
||||
service_catalog = \
|
||||
[{"endpoints": [{"adminURL": self.url % 'admin',
|
||||
"region": "RegionOne",
|
||||
"internalURL": self.url % 'internal',
|
||||
@ -58,7 +58,7 @@ class TestBaseStackUtils(tests.TestCase):
|
||||
self.assertEqual(url, self.url % 'admin')
|
||||
|
||||
def test_url_for_no_service(self):
|
||||
service_catalog =\
|
||||
service_catalog = \
|
||||
[{"endpoints": [{"adminURL": self.url % 'admin',
|
||||
"region": "RegionOne",
|
||||
"internalURL": self.url % 'internal',
|
||||
@ -70,7 +70,7 @@ class TestBaseStackUtils(tests.TestCase):
|
||||
service_catalog, self.service_type)
|
||||
|
||||
def test_url_for_no_endpoints(self):
|
||||
service_catalog =\
|
||||
service_catalog = \
|
||||
[{"type": "fake_service",
|
||||
"name": "foo"}]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user