Fix pep8 errors for zuul

Fix all pep8 errors in stx-gui
Ignore E501,E129 errors (129 is unavoidable without breaking indent)
Story: 2003364
Task: 24419

Change-Id: Ie8d80078c4c9d78a8e0cda99d0b71bd87af883b0
Signed-off-by: Lachlan Plant <lachlan.plant@windriver.com>
This commit is contained in:
Lachlan Plant 2018-08-29 14:20:03 -05:00
parent af152b3ff6
commit 9cca5b0fff
38 changed files with 110 additions and 102 deletions

View File

@ -9,6 +9,7 @@ from horizon import exceptions
from openstack_dashboard.api import base
def get_request_page_size(request, limit=None):
default_limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
try:
@ -17,6 +18,7 @@ def get_request_page_size(request, limit=None):
default_page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20)
return request.session.get('horizon_pagesize', default_page_size)
def is_stx_region(request):
if not base.is_service_enabled(request, 'platform'):
return False

View File

@ -6,6 +6,7 @@
from openstack_dashboard.api.neutron import *
def provider_network_type_list(request, **params):
providernet_types = neutronclient(request).list_providernet_types(
**params).get(

View File

@ -9,6 +9,7 @@ from novaclient.v2 import wrs_providernets
from openstack_dashboard.api.nova import *
def server_group_list(request, all_projects=False):
return novaclient(request).server_groups.list(all_projects)

View File

@ -158,15 +158,15 @@ class JSONView(View):
def add_resource_url(self, view, resources):
tenant_id = self.request.user.tenant_id
for resource in resources:
if (resource.get('tenant_id')
and tenant_id != resource.get('tenant_id')):
if (resource.get('tenant_id') and
tenant_id != resource.get('tenant_id')):
continue
resource['url'] = reverse(view, None, [str(resource['id'])])
def _check_router_external_port(self, ports, router_id, network_id):
for port in ports:
if (port['network_id'] == network_id
and port['device_id'] == router_id):
if (port['network_id'] == network_id and
port['device_id'] == router_id):
return True
return False

View File

@ -253,8 +253,8 @@ class AddStorageVolume(forms.SelfHandlingForm):
if d.istor_uuid and d.istor_uuid != this_stor_uuid:
continue
is_rootfs_device = \
(('stor_function' in d.capabilities)
and (d.capabilities['stor_function'] == 'rootfs'))
(('stor_function' in d.capabilities) and
(d.capabilities['stor_function'] == 'rootfs'))
if is_rootfs_device:
continue
disk_model = d.get_model_num()
@ -592,12 +592,12 @@ class AddPhysicalVolume(forms.SelfHandlingForm):
disk_cap = d.capabilities
# TODO(rchurch): re-factor
is_cinder_device = \
(('device_function' in disk_cap)
and (disk_cap['device_function'] == 'cinder_device'))
(('device_function' in disk_cap) and
(disk_cap['device_function'] == 'cinder_device'))
is_rootfs_device = \
(('stor_function' in disk_cap)
and (disk_cap['stor_function'] == 'rootfs'))
(('stor_function' in disk_cap) and
(disk_cap['stor_function'] == 'rootfs'))
disk_model = d.get_model_num()
# TODO(rchurch): re-factor

View File

@ -430,8 +430,7 @@ class RemoveLocalVolumeGroup(tables.DeleteAction):
cinder_backend = stx_api.sysinv.get_cinder_backend(request)
if lvg.lvm_vg_name == stx_api.sysinv.LVG_NOVA_LOCAL:
return ((host._administrative == 'locked')
or
return ((host._administrative == 'locked') or
(('compute' in host._subfunctions) and
(host.compute_config_required is True)))
elif lvg.lvm_vg_name == stx_api.sysinv.LVG_CINDER_VOLUMES:
@ -552,8 +551,7 @@ class RemovePhysicalVolume(tables.DeleteAction):
cinder_backend = stx_api.sysinv.get_cinder_backend(request)
if pv.lvm_vg_name == stx_api.sysinv.LVG_NOVA_LOCAL:
return ((host._administrative == 'locked')
or
return ((host._administrative == 'locked') or
(('compute' in host._subfunctions) and
(host.compute_config_required is True)))
elif pv.lvm_vg_name == stx_api.sysinv.LVG_CINDER_VOLUMES:

View File

@ -32,8 +32,8 @@ PERSONALITY_CHOICES = (
FIELD_LABEL_PERFORMANCE_PROFILE = _("Performance Profile")
PERFORMANCE_CHOICES = (
(stx_api.sysinv.SUBFUNCTIONS_COMPUTE, _("Standard")),
(stx_api.sysinv.SUBFUNCTIONS_COMPUTE + ','
+ stx_api.sysinv.SUBFUNCTIONS_LOWLATENCY, _("Low Latency")),
(stx_api.sysinv.SUBFUNCTIONS_COMPUTE + ',' +
stx_api.sysinv.SUBFUNCTIONS_LOWLATENCY, _("Low Latency")),
)
PERSONALITY_CHOICES_WITHOUT_STORAGE = (
@ -395,8 +395,8 @@ class UpdateHostInfoAction(workflows.Action):
self.fields[
'interfaceProfile'].widget = forms.widgets.HiddenInput()
if ((personality == 'storage' or 'compute' in host._subfunctions)
and host.disks):
if ((personality == 'storage' or 'compute' in host._subfunctions) and
host.disks):
# Populate Available Disk Profile Choices
try:
disk_profile_tuple_list = [
@ -471,8 +471,8 @@ class UpdateHostInfoAction(workflows.Action):
cleaned_data['subfunctions'] = self._subfunctions
elif cleaned_data['personality'] == stx_api.sysinv.PERSONALITY_CONTROLLER:
if self.system_type == constants.TS_AIO:
self._subfunctions = (stx_api.sysinv.PERSONALITY_CONTROLLER + ','
+ stx_api.sysinv.PERSONALITY_COMPUTE)
self._subfunctions = (stx_api.sysinv.PERSONALITY_CONTROLLER + ',' +
stx_api.sysinv.PERSONALITY_COMPUTE)
else:
self._subfunctions = stx_api.sysinv.PERSONALITY_CONTROLLER
cleaned_data['subfunctions'] = self._subfunctions

View File

@ -35,6 +35,7 @@ from openstack_dashboard.dashboards.project.instances import tables
from starlingx_dashboard.api import nova as stx_nova
class CreateForm(forms.SelfHandlingForm):
tenantP = forms.ChoiceField(label=_("Project"), required=True)
name = forms.CharField(max_length="255", label=_("Server Group Name"))

View File

@ -35,7 +35,6 @@ from openstack_dashboard.dashboards.project.instances import tables
from starlingx_dashboard.api import nova as stx_nova
class CreateForm(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Server Group Name"))
policy = forms.ChoiceField(label=_("Policy"),

View File

@ -25,6 +25,7 @@ from openstack_dashboard.api import nova
from starlingx_dashboard.api import nova as stx_nova
class OverviewTab(tabs.Tab):
name = _("Overview")
slug = "overview"

View File

@ -8,4 +8,3 @@ PANEL_GROUP = 'platform'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'starlingx_dashboard.dashboards.admin.' \
'fault_management.panel.FaultManagement'

View File

@ -8,4 +8,3 @@ PANEL_GROUP = 'platform'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'starlingx_dashboard.dashboards.admin.software_management.' \
'panel.SoftwareManagement'

View File

@ -7,4 +7,3 @@ PANEL_GROUP = 'platform'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'starlingx_dashboard.dashboards.admin.inventory.panel.Inventory'

View File

@ -14,6 +14,7 @@ from horizon.tables import FilterAction
DEFAULT_TABLE_LIMITS = [10, 20, 50, 100, 500, 1000]
class FixedWithQueryFilter(FilterAction):
"""A FilterAction that visually renders like a combination
FixedFilterAction and a FilterAction of type "query.

View File

@ -28,6 +28,13 @@ commands =
-o -type f -name '*.yaml' \
-print0 | xargs --no-run-if-empty -0 yamllint"
[pep8]
# Ignoring these warnings
# E501 line too long
ignore = E501,E129
[testenv:pep8]
usedevelop = False
skip_install = True