Enable E121,E122,E123,E124,E125,E129 flake8 tests
Enable the tests and update flake8 comments to note that H904 is ignored on purpose. The patch fixes these warnings: ./manila/api/views/limits.py:68:5: E129 visually indented line with same indent as next logical line ./manila/share/drivers/netapp/cluster_mode.py:352:13: E122 continuation line missing indentation or outdented ./manila/scheduler/scheduler_options.py:98:13: E129 visually indented line with same indent as next logical line ./contrib/tempest/tempest/api/share/base.py:210:5: E129 visually indented line with same indent as next logical line ./contrib/tempest/tempest/api/share/test_rules.py:32:13: E129 visually indented line with same indent as next logical line ./contrib/tempest/tempest/api/share/test_rules.py:90:13: E129 visually indented line with same indent as next logical line ./manila/api/views/share_servers.py:28:9: E124 closing bracket does not match visual indentation ./manila/api/views/share_servers.py:34:9: E124 closing bracket does not match visual indentation ./manila/share/drivers/netapp/driver.py:336:5: E125 continuation line with same indent as next logical line Also fixes other pep8 warnings in these files. Partial-Fix: #1333290 Change-Id: Ida14ea8f4716e49f7379f929971fd5e462541527
This commit is contained in:
parent
b5873b8561
commit
e287c9e263
@ -87,7 +87,8 @@ class ShareUserRulesForNFSTest(base.BaseSharesTest):
|
||||
def setUpClass(cls):
|
||||
super(ShareUserRulesForNFSTest, cls).setUpClass()
|
||||
if (cls.protocol not in CONF.share.enable_protocols or
|
||||
cls.protocol not in CONF.share.enable_user_rules_for_protocols):
|
||||
cls.protocol not in
|
||||
CONF.share.enable_user_rules_for_protocols):
|
||||
msg = "USER rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
__, cls.share = cls.create_share(cls.protocol)
|
||||
|
@ -23,12 +23,14 @@ class ViewBuilder(common.ViewBuilder):
|
||||
|
||||
def build_share_server(self, share_server):
|
||||
"""View of a share server."""
|
||||
return {'share_server':
|
||||
return {
|
||||
'share_server':
|
||||
self._build_share_server_view(share_server, detailed=True)
|
||||
}
|
||||
|
||||
def build_share_servers(self, share_servers):
|
||||
return {'share_servers':
|
||||
return {
|
||||
'share_servers':
|
||||
[self._build_share_server_view(share_server)
|
||||
for share_server in share_servers]
|
||||
}
|
||||
|
@ -236,9 +236,15 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
|
||||
def _get_node_data_port(self, node):
|
||||
"""Get data port on the node."""
|
||||
args = {'query': {'net-port-info': {'node': node,
|
||||
args = {
|
||||
'query': {
|
||||
'net-port-info': {
|
||||
'node': node,
|
||||
'port-type': 'physical',
|
||||
'role': 'data'}}}
|
||||
'role': 'data'
|
||||
}
|
||||
}
|
||||
}
|
||||
port_info = self._client.send_request('net-port-get-iter', args)
|
||||
try:
|
||||
port = port_info.get_child_by_name('attributes-list')\
|
||||
@ -274,8 +280,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
aggrs = self._client.send_request('aggr-get-iter')\
|
||||
.get_child_by_name('attributes-list').get_children()
|
||||
except AttributeError:
|
||||
msg = _("Have not found aggregates match pattern %s")\
|
||||
% pattern
|
||||
msg = _("Have not found aggregates match pattern %s") % pattern
|
||||
LOG.error(msg)
|
||||
raise exception.NetAppException(msg)
|
||||
aggr_list = [aggr for aggr in aggrs if re.match(
|
||||
@ -309,8 +314,8 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
_("Failed to create vlan %(vlan)s on "
|
||||
"port %(port)s. %(err_msg)") %
|
||||
{'vlan': vlan, 'port': port, 'err_msg': e.message})
|
||||
iface_name = self.configuration.netapp_lif_name_template % \
|
||||
{'node': node, 'net_allocation_id': allocation_id}
|
||||
iface_name = (self.configuration.netapp_lif_name_template %
|
||||
{'node': node, 'net_allocation_id': allocation_id})
|
||||
LOG.debug('Creating LIF %(lif)r for vserver %(vserver)s '
|
||||
% {'lif': iface_name, 'vserver': vserver_name})
|
||||
args = {'address': ip,
|
||||
@ -369,8 +374,8 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
|
||||
def _vserver_create_if_not_exists(self, network_info):
|
||||
"""Creates vserver if not exists with given parameters."""
|
||||
vserver_name = self.configuration.netapp_vserver_name_template % \
|
||||
network_info['server_id']
|
||||
vserver_name = (self.configuration.netapp_vserver_name_template %
|
||||
network_info['server_id'])
|
||||
vserver_client = NetAppApiClient(
|
||||
self.api_version, vserver=vserver_name,
|
||||
configuration=self.configuration)
|
||||
@ -560,8 +565,8 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
}
|
||||
ifaces = vserver_client.send_request('net-interface-get-iter',
|
||||
args)
|
||||
if not ifaces.get_child_content('num_records') or \
|
||||
ifaces.get_child_content('num_records') == '0':
|
||||
if (not ifaces.get_child_content('num_records') or
|
||||
ifaces.get_child_content('num_records') == '0'):
|
||||
self._create_net_iface(ip, netmask, vlan, node, port, vserver_name,
|
||||
allocation_id)
|
||||
|
||||
@ -756,10 +761,10 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
args = {'volume': share_name}
|
||||
snapshots = vserver_client.send_request('snapshot-list-info',
|
||||
args)
|
||||
for snap in snapshots.get_child_by_name('snapshots')\
|
||||
.get_children():
|
||||
if snap.get_child_by_name('name').get_content() == snapshot_name\
|
||||
and snap.get_child_by_name('busy').get_content() == 'true':
|
||||
for snap in snapshots.get_child_by_name('snapshots').get_children():
|
||||
if (snap.get_child_by_name('name').get_content() == snapshot_name
|
||||
and (snap.get_child_by_name('busy').get_content()
|
||||
== 'true')):
|
||||
return True
|
||||
|
||||
def _share_unmount(self, share, vserver_client):
|
||||
@ -793,8 +798,7 @@ class NetAppClusteredShareDriver(driver.ShareDriver):
|
||||
|
||||
def _delete_vserver(self, vserver_name, vserver_client,
|
||||
security_services=None):
|
||||
"""
|
||||
Delete vserver.
|
||||
"""Delete vserver.
|
||||
|
||||
Checks if vserver exists and does not have active shares.
|
||||
Offlines and destroys root volumes.
|
||||
|
@ -83,8 +83,7 @@ class NetAppApiClient(object):
|
||||
|
||||
|
||||
class NetAppShareDriver(driver.ShareDriver):
|
||||
"""
|
||||
NetApp specific ONTAP 7-mode driver.
|
||||
"""NetApp specific ONTAP 7-mode driver.
|
||||
|
||||
Supports NFS and CIFS protocols.
|
||||
Uses Ontap devices as backend to create shares
|
||||
@ -225,11 +224,12 @@ class NetAppShareDriver(driver.ShareDriver):
|
||||
return helper.deny_access(context, share, access)
|
||||
|
||||
def _check_vfiler_exists(self):
|
||||
vfiler_status = self._client.send_request('vfiler-get-status',
|
||||
vfiler_status = self._client.send_request(
|
||||
'vfiler-get-status',
|
||||
{'vfiler': self.configuration.netapp_nas_vfiler})
|
||||
if vfiler_status.get_child_content('status') != 'running':
|
||||
msg = _("Vfiler %s is not running") \
|
||||
% self.configuration.netapp_nas_vfiler
|
||||
msg = (_("Vfiler %s is not running")
|
||||
% self.configuration.netapp_nas_vfiler)
|
||||
LOG.error(msg)
|
||||
raise exception.NetAppException(msg)
|
||||
|
||||
@ -238,8 +238,10 @@ class NetAppShareDriver(driver.ShareDriver):
|
||||
licenses = self._client.send_request('license-v2-list-info')
|
||||
except naapi.NaApiError:
|
||||
licenses = self._client.send_request('license-list-info')
|
||||
self._licenses = [l.get_child_content('package').lower() for l in
|
||||
licenses.get_child_by_name('licenses').get_children()]
|
||||
self._licenses = [l.get_child_content('package').lower()
|
||||
for l in
|
||||
licenses.get_child_by_name('licenses').get_children()
|
||||
]
|
||||
LOG.info(_("Available licenses: %s") % ', '.join(self._licenses))
|
||||
return self._licenses
|
||||
|
||||
@ -290,8 +292,8 @@ class NetAppShareDriver(driver.ShareDriver):
|
||||
.get_children()
|
||||
|
||||
if not aggr_list_elements:
|
||||
msg = _("No aggregate assigned to vfiler %s")\
|
||||
% self.configuration.netapp_nas_vfiler
|
||||
msg = (_("No aggregate assigned to vfiler %s")
|
||||
% self.configuration.netapp_nas_vfiler)
|
||||
LOG.error(msg)
|
||||
raise exception.NetAppException(msg)
|
||||
|
||||
@ -332,14 +334,14 @@ class NetAppShareDriver(driver.ShareDriver):
|
||||
snapshots = snapshots.get_child_by_name('snapshots')
|
||||
if snapshots:
|
||||
for snap in snapshots.get_children():
|
||||
if snap.get_child_content('name') == snapshot_name \
|
||||
and snap.get_child_content('busy') == 'true':
|
||||
if (snap.get_child_content('name') == snapshot_name
|
||||
and snap.get_child_content('busy') == 'true'):
|
||||
return True
|
||||
|
||||
def _get_valid_share_name(self, share_id):
|
||||
"""Get share name according to share name template."""
|
||||
return self.configuration.netapp_nas_volume_name_template %\
|
||||
{'share_id': share_id.replace('-', '_')}
|
||||
return (self.configuration.netapp_nas_volume_name_template %
|
||||
{'share_id': share_id.replace('-', '_')})
|
||||
|
||||
def _get_valid_snapshot_name(self, snapshot_id):
|
||||
"""Get snapshot name according to snapshot name template."""
|
||||
|
7
tox.ini
7
tox.ini
@ -44,6 +44,11 @@ commands = bash tools/lintstack.sh
|
||||
# TODO: These are not intentionally disabled, reenable when fixed:
|
||||
# H405: multi line docstring summary not separated with an empty line
|
||||
# H501: Do not use locals() for string formatting
|
||||
ignore = E12,H302,H303,H404,H405,H501,H904,F401,F403,F841
|
||||
#
|
||||
# Following checks are ignored on purpose:
|
||||
#
|
||||
# H904 wrap long lines in parentheses instead of a backslash
|
||||
# reason: removed in hacking (https://review.openstack.org/#/c/101701/)
|
||||
ignore = E126,E127,E128,H302,H303,H404,H405,H501,H904,F401,F403,F841
|
||||
builtins = _
|
||||
exclude = .venv,.tox,dist,doc,openstack,*egg
|
||||
|
Loading…
Reference in New Issue
Block a user