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

View File

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

View File

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

View File

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

View File

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

View File

@ -430,8 +430,7 @@ class RemoveLocalVolumeGroup(tables.DeleteAction):
cinder_backend = stx_api.sysinv.get_cinder_backend(request) cinder_backend = stx_api.sysinv.get_cinder_backend(request)
if lvg.lvm_vg_name == stx_api.sysinv.LVG_NOVA_LOCAL: if lvg.lvm_vg_name == stx_api.sysinv.LVG_NOVA_LOCAL:
return ((host._administrative == 'locked') return ((host._administrative == 'locked') or
or
(('compute' in host._subfunctions) and (('compute' in host._subfunctions) and
(host.compute_config_required is True))) (host.compute_config_required is True)))
elif lvg.lvm_vg_name == stx_api.sysinv.LVG_CINDER_VOLUMES: 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) cinder_backend = stx_api.sysinv.get_cinder_backend(request)
if pv.lvm_vg_name == stx_api.sysinv.LVG_NOVA_LOCAL: if pv.lvm_vg_name == stx_api.sysinv.LVG_NOVA_LOCAL:
return ((host._administrative == 'locked') return ((host._administrative == 'locked') or
or
(('compute' in host._subfunctions) and (('compute' in host._subfunctions) and
(host.compute_config_required is True))) (host.compute_config_required is True)))
elif pv.lvm_vg_name == stx_api.sysinv.LVG_CINDER_VOLUMES: 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") FIELD_LABEL_PERFORMANCE_PROFILE = _("Performance Profile")
PERFORMANCE_CHOICES = ( PERFORMANCE_CHOICES = (
(stx_api.sysinv.SUBFUNCTIONS_COMPUTE, _("Standard")), (stx_api.sysinv.SUBFUNCTIONS_COMPUTE, _("Standard")),
(stx_api.sysinv.SUBFUNCTIONS_COMPUTE + ',' (stx_api.sysinv.SUBFUNCTIONS_COMPUTE + ',' +
+ stx_api.sysinv.SUBFUNCTIONS_LOWLATENCY, _("Low Latency")), stx_api.sysinv.SUBFUNCTIONS_LOWLATENCY, _("Low Latency")),
) )
PERSONALITY_CHOICES_WITHOUT_STORAGE = ( PERSONALITY_CHOICES_WITHOUT_STORAGE = (
@ -395,8 +395,8 @@ class UpdateHostInfoAction(workflows.Action):
self.fields[ self.fields[
'interfaceProfile'].widget = forms.widgets.HiddenInput() 'interfaceProfile'].widget = forms.widgets.HiddenInput()
if ((personality == 'storage' or 'compute' in host._subfunctions) if ((personality == 'storage' or 'compute' in host._subfunctions) and
and host.disks): host.disks):
# Populate Available Disk Profile Choices # Populate Available Disk Profile Choices
try: try:
disk_profile_tuple_list = [ disk_profile_tuple_list = [
@ -471,8 +471,8 @@ class UpdateHostInfoAction(workflows.Action):
cleaned_data['subfunctions'] = self._subfunctions cleaned_data['subfunctions'] = self._subfunctions
elif cleaned_data['personality'] == stx_api.sysinv.PERSONALITY_CONTROLLER: elif cleaned_data['personality'] == stx_api.sysinv.PERSONALITY_CONTROLLER:
if self.system_type == constants.TS_AIO: if self.system_type == constants.TS_AIO:
self._subfunctions = (stx_api.sysinv.PERSONALITY_CONTROLLER + ',' self._subfunctions = (stx_api.sysinv.PERSONALITY_CONTROLLER + ',' +
+ stx_api.sysinv.PERSONALITY_COMPUTE) stx_api.sysinv.PERSONALITY_COMPUTE)
else: else:
self._subfunctions = stx_api.sysinv.PERSONALITY_CONTROLLER self._subfunctions = stx_api.sysinv.PERSONALITY_CONTROLLER
cleaned_data['subfunctions'] = self._subfunctions 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 from starlingx_dashboard.api import nova as stx_nova
class CreateForm(forms.SelfHandlingForm): class CreateForm(forms.SelfHandlingForm):
tenantP = forms.ChoiceField(label=_("Project"), required=True) tenantP = forms.ChoiceField(label=_("Project"), required=True)
name = forms.CharField(max_length="255", label=_("Server Group Name")) 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 from starlingx_dashboard.api import nova as stx_nova
class CreateForm(forms.SelfHandlingForm): class CreateForm(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Server Group Name")) name = forms.CharField(max_length="255", label=_("Server Group Name"))
policy = forms.ChoiceField(label=_("Policy"), 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 from starlingx_dashboard.api import nova as stx_nova
class OverviewTab(tabs.Tab): class OverviewTab(tabs.Tab):
name = _("Overview") name = _("Overview")
slug = "overview" slug = "overview"

View File

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

View File

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

View File

@ -7,4 +7,3 @@ PANEL_GROUP = 'platform'
# Python panel class of the PANEL to be added. # Python panel class of the PANEL to be added.
ADD_PANEL = 'starlingx_dashboard.dashboards.admin.inventory.panel.Inventory' 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] DEFAULT_TABLE_LIMITS = [10, 20, 50, 100, 500, 1000]
class FixedWithQueryFilter(FilterAction): class FixedWithQueryFilter(FilterAction):
"""A FilterAction that visually renders like a combination """A FilterAction that visually renders like a combination
FixedFilterAction and a FilterAction of type "query. FixedFilterAction and a FilterAction of type "query.

View File

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