Hacking: Fix E117

Fix:
E117 over-indented

Fix also other hacking problems found in files touched.

Change-Id: I948bfa4aef8c35f9a94cebec9e93fce8fd5f9ae3
This commit is contained in:
Andreas Jaeger 2020-04-01 11:27:57 +02:00
parent 7022c8dfe8
commit 0c6b39d9a2
8 changed files with 82 additions and 82 deletions

View File

@ -1562,8 +1562,8 @@ class API(base.Base):
context, service_host, 'manila-share')
if utils.service_is_up(service):
self.share_rpcapi.migration_cancel(
context, share_instance_ref, migrating_instance_id)
self.share_rpcapi.migration_cancel(
context, share_instance_ref, migrating_instance_id)
else:
migrating = False
@ -1840,7 +1840,7 @@ class API(base.Base):
raise exception.InvalidShare(message=msg)
for share_instance in share.instances:
self.deny_access_to_instance(ctx, share_instance, access)
self.deny_access_to_instance(ctx, share_instance, access)
def deny_access_to_instance(self, context, share_instance, access):
self._conditionally_transition_share_instance_access_rules_status(

View File

@ -3095,12 +3095,12 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
for storage_disk_info in attributes_list.get_children():
disk_raid_info = storage_disk_info.get_child_by_name(
'disk-raid-info') or netapp_api.NaElement('none')
disk_type = disk_raid_info.get_child_content(
'effective-disk-type')
if disk_type:
disk_types.add(disk_type)
disk_raid_info = storage_disk_info.get_child_by_name(
'disk-raid-info') or netapp_api.NaElement('none')
disk_type = disk_raid_info.get_child_content(
'effective-disk-type')
if disk_type:
disk_types.add(disk_type)
return disk_types

View File

@ -1429,46 +1429,46 @@ class ShareManager(manager.SchedulerDependentManager):
dest_share_instance)
except Exception:
msg = _("Driver migration completion failed for"
" share %s.") % share_ref['id']
LOG.exception(msg)
msg = _("Driver migration completion failed for"
" share %s.") % share_ref['id']
LOG.exception(msg)
# NOTE(ganso): If driver fails during migration-complete,
# all instances are set to error and it is up to the admin
# to fix the problem to either complete migration
# manually or clean it up. At this moment, data
# preservation at the source backend cannot be
# guaranteed.
# NOTE(ganso): If driver fails during migration-complete,
# all instances are set to error and it is up to the admin
# to fix the problem to either complete migration
# manually or clean it up. At this moment, data
# preservation at the source backend cannot be
# guaranteed.
self._restore_migrating_snapshots_status(
context, src_share_instance['id'],
errored_dest_instance_id=dest_share_instance['id'])
self.db.share_instance_update(
context, src_instance_id,
{'status': constants.STATUS_ERROR})
self.db.share_instance_update(
context, dest_instance_id,
{'status': constants.STATUS_ERROR})
self.db.share_update(
context, share_ref['id'],
{'task_state': constants.TASK_STATE_MIGRATION_ERROR})
raise exception.ShareMigrationFailed(reason=msg)
self._restore_migrating_snapshots_status(
context, src_share_instance['id'],
errored_dest_instance_id=dest_share_instance['id'])
self.db.share_instance_update(
context, src_instance_id,
{'status': constants.STATUS_ERROR})
self.db.share_instance_update(
context, dest_instance_id,
{'status': constants.STATUS_ERROR})
self.db.share_update(
context, share_ref['id'],
{'task_state': constants.TASK_STATE_MIGRATION_ERROR})
raise exception.ShareMigrationFailed(reason=msg)
else:
try:
self._migration_complete_host_assisted(
context, share_ref, src_instance_id,
dest_instance_id)
except Exception:
msg = _("Host-assisted migration completion failed for"
" share %s.") % share_ref['id']
LOG.exception(msg)
self.db.share_update(
context, share_ref['id'],
{'task_state': constants.TASK_STATE_MIGRATION_ERROR})
self.db.share_instance_update(
context, src_instance_id,
{'status': constants.STATUS_AVAILABLE})
raise exception.ShareMigrationFailed(reason=msg)
msg = _("Host-assisted migration completion failed for"
" share %s.") % share_ref['id']
LOG.exception(msg)
self.db.share_update(
context, share_ref['id'],
{'task_state': constants.TASK_STATE_MIGRATION_ERROR})
self.db.share_instance_update(
context, src_instance_id,
{'status': constants.STATUS_AVAILABLE})
raise exception.ShareMigrationFailed(reason=msg)
model_update = self._get_extra_specs_from_share_type(
context, dest_share_instance['share_type_id'])
@ -1986,14 +1986,14 @@ class ShareManager(manager.SchedulerDependentManager):
exception=excep)
if replica_ref.get('export_locations'):
if isinstance(replica_ref.get('export_locations'), list):
self.db.share_export_locations_update(
context, share_replica['id'],
replica_ref.get('export_locations'))
else:
msg = ('Invalid export locations passed to the share '
'manager.')
LOG.warning(msg)
if isinstance(replica_ref.get('export_locations'), list):
self.db.share_export_locations_update(
context, share_replica['id'],
replica_ref.get('export_locations'))
else:
msg = ('Invalid export locations passed to the share '
'manager.')
LOG.warning(msg)
if replica_ref.get('replica_state'):
self.db.share_replica_update(

View File

@ -155,6 +155,7 @@ def app():
mapper['/v2'] = router_v2.APIRouter()
return mapper
fixture_reset_status_with_different_roles_v1 = (
{
'role': 'admin',
@ -280,31 +281,31 @@ def mock_fake_admin_check(context, resource_name, action, *args, **kwargs):
class FakeResourceViewBuilder(api_common.ViewBuilder):
_collection_name = 'fake_resource'
_detail_version_modifiers = [
"add_field_xyzzy",
"add_field_spoon_for_admins",
"remove_field_foo",
]
_collection_name = 'fake_resource'
_detail_version_modifiers = [
"add_field_xyzzy",
"add_field_spoon_for_admins",
"remove_field_foo",
]
def view(self, req, resource):
def view(self, req, resource):
keys = ('id', 'foo', 'fred', 'alice')
resource_dict = {key: resource.get(key) for key in keys}
keys = ('id', 'foo', 'fred', 'alice')
resource_dict = {key: resource.get(key) for key in keys}
self.update_versioned_resource_dict(req, resource_dict, resource)
self.update_versioned_resource_dict(req, resource_dict, resource)
return resource_dict
return resource_dict
@api_common.ViewBuilder.versioned_method("1.41")
def add_field_xyzzy(self, context, resource_dict, resource):
resource_dict['xyzzy'] = resource.get('xyzzy')
@api_common.ViewBuilder.versioned_method("1.41")
def add_field_xyzzy(self, context, resource_dict, resource):
resource_dict['xyzzy'] = resource.get('xyzzy')
@api_common.ViewBuilder.versioned_method("1.6")
def add_field_spoon_for_admins(self, context, resource_dict, resource):
if context.is_admin:
resource_dict['spoon'] = resource.get('spoon')
@api_common.ViewBuilder.versioned_method("1.6")
def add_field_spoon_for_admins(self, context, resource_dict, resource):
if context.is_admin:
resource_dict['spoon'] = resource.get('spoon')
@api_common.ViewBuilder.versioned_method("3.14")
def remove_field_foo(self, context, resource_dict, resource):
resource_dict.pop('foo', None)
@api_common.ViewBuilder.versioned_method("3.14")
def remove_field_foo(self, context, resource_dict, resource):
resource_dict.pop('foo', None)

View File

@ -74,7 +74,7 @@ class SchedulerManagerTestCase(test.TestCase):
self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
def raise_no_valid_host(self, *args, **kwargs):
raise exception.NoValidHost(reason="")
raise exception.NoValidHost(reason="")
def test_1_correct_init(self):
# Correct scheduler driver

View File

@ -133,11 +133,11 @@ class XMLAPIConnectorTest(test.TestCase):
class MockSSH(object):
def __enter__(self):
return self
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
pass
def __exit__(self, type, value, traceback):
pass
class MockSSHPool(object):

View File

@ -346,11 +346,11 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase):
self._mock_export.get_export_path())
for network_space_ip in \
(_MOCK_NETWORK_SPACE_IP_1, _MOCK_NETWORK_SPACE_IP_2):
self.assertIn(
"{network_space_ip}:{export_path}".format(
network_space_ip=network_space_ip,
export_path=self._mock_export.get_export_path()),
export_paths)
self.assertIn(
"{network_space_ip}:{export_path}".format(
network_space_ip=network_space_ip,
export_path=self._mock_export.get_export_path()),
export_paths)
def test__get_export(self):
# The default return value of get_exports is [mock_export, ]:

View File

@ -137,8 +137,7 @@ commands = alembic -c manila/db/migrations/alembic.ini revision -m ""{posargs}
# E741 ambiguous variable name 'l'
# E305 expected 2 blank lines after class or function definition, found 1
# E731 do not assign a lambda expression, use a def
# E117 over-indented
ignore = E117,E123,E305,E402,E731,E741,W503,W504,W605
ignore = E123,E305,E402,E731,E741,W503,W504,W605
builtins = _
# [H106] Don't put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.