trivial: Resolve (most) flake8 3.x issues
A future change will bump flake8 to 3.x. See off most of the issues that this will introduce now, with the exception of some missing typing imports in 'nova/virt/hardware.py' - fixing those here with the current version of flake8 would actually raise an error about unused imports. Change-Id: I9480ac1749d448efe4f415f5e80ff9b9837216b6 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
4c8f3990c6
commit
9428ebfed9
@ -103,11 +103,11 @@ class Network(obj_base.NovaPersistentObject, obj_base.NovaObject,
|
|||||||
def _from_db_object(context, network, db_network):
|
def _from_db_object(context, network, db_network):
|
||||||
for field in network.fields:
|
for field in network.fields:
|
||||||
db_value = db_network[field]
|
db_value = db_network[field]
|
||||||
if field is 'netmask_v6' and db_value is not None:
|
if field == 'netmask_v6' and db_value is not None:
|
||||||
db_value = network._convert_legacy_ipv6_netmask(db_value)
|
db_value = network._convert_legacy_ipv6_netmask(db_value)
|
||||||
if field is 'dhcp_server' and db_value is None:
|
if field == 'dhcp_server' and db_value is None:
|
||||||
db_value = db_network['gateway']
|
db_value = db_network['gateway']
|
||||||
if field is 'share_address' and CONF.share_dhcp_address:
|
if field == 'share_address' and CONF.share_dhcp_address:
|
||||||
db_value = CONF.share_dhcp_address
|
db_value = CONF.share_dhcp_address
|
||||||
|
|
||||||
network[field] = db_value
|
network[field] = db_value
|
||||||
|
@ -49,7 +49,7 @@ class SecurityGroup(base.NovaPersistentObject, base.NovaObject):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _from_db_object(context, secgroup, db_secgroup):
|
def _from_db_object(context, secgroup, db_secgroup):
|
||||||
for field in secgroup.fields:
|
for field in secgroup.fields:
|
||||||
if field is not 'uuid':
|
if field != 'uuid':
|
||||||
setattr(secgroup, field, db_secgroup[field])
|
setattr(secgroup, field, db_secgroup[field])
|
||||||
secgroup._context = context
|
secgroup._context = context
|
||||||
secgroup.obj_reset_changes()
|
secgroup.obj_reset_changes()
|
||||||
|
@ -2397,7 +2397,7 @@ class HostNameWeigher(weights.BaseHostWeigher):
|
|||||||
self.weights = self.get_weights()
|
self.weights = self.get_weights()
|
||||||
|
|
||||||
def get_weights(self):
|
def get_weights(self):
|
||||||
raise NotImplemented()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def _weigh_object(self, host_state, weight_properties):
|
def _weigh_object(self, host_state, weight_properties):
|
||||||
# Any unspecified host gets no weight.
|
# Any unspecified host gets no weight.
|
||||||
|
@ -1399,10 +1399,10 @@ class AssistedSnapshotDeleteTestCaseV21(test.NoDBTestCase):
|
|||||||
self.controller.delete(req, '5')
|
self.controller.delete(req, '5')
|
||||||
|
|
||||||
def test_delete_duplicate_query_parameters_validation(self):
|
def test_delete_duplicate_query_parameters_validation(self):
|
||||||
params = {
|
params = [
|
||||||
'delete_info': jsonutils.dumps({'volume_id': '1'}),
|
('delete_info', jsonutils.dumps({'volume_id': '1'})),
|
||||||
'delete_info': jsonutils.dumps({'volume_id': '2'})
|
('delete_info', jsonutils.dumps({'volume_id': '2'}))
|
||||||
}
|
]
|
||||||
req = fakes.HTTPRequest.blank(
|
req = fakes.HTTPRequest.blank(
|
||||||
self.url + '?%s' %
|
self.url + '?%s' %
|
||||||
urllib.parse.urlencode(params),
|
urllib.parse.urlencode(params),
|
||||||
|
@ -333,7 +333,7 @@ class DriverVolumeBlockDevice(DriverBlockDevice):
|
|||||||
'%(mp)s : %(err)s',
|
'%(mp)s : %(err)s',
|
||||||
{'volume_id': volume_id, 'mp': mp,
|
{'volume_id': volume_id, 'mp': mp,
|
||||||
'err': err}, instance=instance)
|
'err': err}, instance=instance)
|
||||||
except exception.DeviceDetachFailed as err:
|
except exception.DeviceDetachFailed:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.warning('Guest refused to detach volume %(vol)s',
|
LOG.warning('Guest refused to detach volume %(vol)s',
|
||||||
{'vol': volume_id}, instance=instance)
|
{'vol': volume_id}, instance=instance)
|
||||||
|
@ -76,7 +76,7 @@ class ConfigDrivePowerVM(object):
|
|||||||
# OVS is the only supported vif type. All others (SEA, PowerVM SR-IOV)
|
# OVS is the only supported vif type. All others (SEA, PowerVM SR-IOV)
|
||||||
# will default to generic vif.
|
# will default to generic vif.
|
||||||
for vif in network_info:
|
for vif in network_info:
|
||||||
if vif.get('type') is not 'ovs':
|
if vif.get('type') != 'ovs':
|
||||||
LOG.debug('Changing vif type from %(type)s to vif for vif '
|
LOG.debug('Changing vif type from %(type)s to vif for vif '
|
||||||
'%(id)s.', {'type': vif.get('type'),
|
'%(id)s.', {'type': vif.get('type'),
|
||||||
'id': vif.get('id')})
|
'id': vif.get('id')})
|
||||||
|
Loading…
Reference in New Issue
Block a user