From 9cca5b0fff6cf961648453ca44d291090f4cc623 Mon Sep 17 00:00:00 2001 From: Lachlan Plant Date: Wed, 29 Aug 2018 14:20:03 -0500 Subject: [PATCH] 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 --- setup.py | 2 +- starlingx_dashboard/api/base.py | 10 +++++---- starlingx_dashboard/api/neutron.py | 9 ++++---- starlingx_dashboard/api/nova.py | 9 ++++---- .../dashboards/admin/fault_management/tabs.py | 6 ++--- .../dashboards/admin/host_topology/views.py | 8 +++---- .../admin/inventory/devices/views.py | 4 ++-- .../admin/inventory/interfaces/views.py | 6 ++--- .../admin/inventory/memories/views.py | 2 +- .../dashboards/admin/inventory/ports/views.py | 2 +- .../admin/inventory/sensors/forms.py | 4 ++-- .../admin/inventory/sensors/views.py | 4 ++-- .../admin/inventory/storages/forms.py | 16 +++++++------- .../admin/inventory/storages/tables.py | 14 +++++------- .../admin/inventory/storages/views.py | 2 +- .../dashboards/admin/inventory/tables.py | 2 +- .../dashboards/admin/inventory/views.py | 10 ++++----- .../dashboards/admin/inventory/workflows.py | 22 +++++++++---------- .../providernets/providernets/ranges/views.py | 4 ++-- .../dashboards/admin/server_groups/forms.py | 1 + .../admin/software_management/tables.py | 6 ++--- .../admin/software_management/tabs.py | 2 +- .../admin/software_management/views.py | 2 +- .../system_config/address_pools/forms.py | 2 +- .../dashboards/admin/system_config/forms.py | 16 +++++++------- .../dashboards/admin/system_config/views.py | 4 ++-- .../dashboards/project/server_groups/forms.py | 3 +-- .../dashboards/project/server_groups/tabs.py | 1 + ..._starlingx_admin_fault_management_panel.py | 1 - ...ingx_platform_software_management_panel.py | 1 - .../_2035_starlingx_admin_inventory_panel.py | 1 - ...arlingx_platform_storage_overview_panel.py | 2 +- .../_2039_starlingx_admin_system_config.py | 2 +- .../horizon/tables/__init__.py | 2 +- starlingx_dashboard/horizon/tables/actions.py | 11 +++++----- starlingx_dashboard/usage/quotas.py | 10 ++++----- starlingx_dashboard/version.py | 2 +- tox.ini | 7 ++++++ 38 files changed, 110 insertions(+), 102 deletions(-) diff --git a/setup.py b/setup.py index 5751d32e..fce7af1e 100644 --- a/setup.py +++ b/setup.py @@ -26,4 +26,4 @@ except ImportError: setuptools.setup( setup_requires=['pbr>=1.8'], - pbr=True) \ No newline at end of file + pbr=True) diff --git a/starlingx_dashboard/api/base.py b/starlingx_dashboard/api/base.py index f7fcd8f5..d3c1bcaa 100644 --- a/starlingx_dashboard/api/base.py +++ b/starlingx_dashboard/api/base.py @@ -1,7 +1,7 @@ -# -# Copyright (c) 2018 Intel Corporation -# -# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 # import six from django.conf import settings @@ -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 diff --git a/starlingx_dashboard/api/neutron.py b/starlingx_dashboard/api/neutron.py index 4593dff6..731e26b6 100644 --- a/starlingx_dashboard/api/neutron.py +++ b/starlingx_dashboard/api/neutron.py @@ -1,11 +1,12 @@ -# -# Copyright (c) 2018 Intel Corporation -# -# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 # from openstack_dashboard.api.neutron import * + def provider_network_type_list(request, **params): providernet_types = neutronclient(request).list_providernet_types( **params).get( diff --git a/starlingx_dashboard/api/nova.py b/starlingx_dashboard/api/nova.py index f8db6757..2a52a870 100644 --- a/starlingx_dashboard/api/nova.py +++ b/starlingx_dashboard/api/nova.py @@ -1,7 +1,7 @@ -# -# Copyright (c) 2018 Intel Corporation -# -# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 # from novaclient.v2 import wrs_pci @@ -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) diff --git a/starlingx_dashboard/dashboards/admin/fault_management/tabs.py b/starlingx_dashboard/dashboards/admin/fault_management/tabs.py index 7d0601c5..1a293c5e 100755 --- a/starlingx_dashboard/dashboards/admin/fault_management/tabs.py +++ b/starlingx_dashboard/dashboards/admin/fault_management/tabs.py @@ -124,9 +124,9 @@ class ActiveAlarmsTab(tabs.TableTab): search_opts = self.get_filters() search_opts.update({ - 'paginate': True, - 'sort_key': 'severity,entity_instance_id', - 'sort_dir': 'asc'}) + 'paginate': True, + 'sort_key': 'severity,entity_instance_id', + 'sort_dir': 'asc'}) alarms = [] try: diff --git a/starlingx_dashboard/dashboards/admin/host_topology/views.py b/starlingx_dashboard/dashboards/admin/host_topology/views.py index e62d5dc6..728d412c 100755 --- a/starlingx_dashboard/dashboards/admin/host_topology/views.py +++ b/starlingx_dashboard/dashboards/admin/host_topology/views.py @@ -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 diff --git a/starlingx_dashboard/dashboards/admin/inventory/devices/views.py b/starlingx_dashboard/dashboards/admin/inventory/devices/views.py index c2dbced0..f1c91060 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/devices/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/devices/views.py @@ -42,7 +42,7 @@ class UpdateView(forms.ModalFormView): host_id = self.kwargs['host_id'] try: self._object = stx_api.sysinv.host_device_get(self.request, - device_uuid) + device_uuid) self._object.host_id = host_id except Exception: redirect = reverse("horizon:admin:inventory:detail", @@ -85,7 +85,7 @@ class DetailView(views.HorizonTemplateView): host_id = self.kwargs['host_id'] try: self._object = stx_api.sysinv.host_device_get(self.request, - device_uuid) + device_uuid) self._object.host_id = host_id except Exception: diff --git a/starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py b/starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py index 7da065f2..8de38e4f 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/interfaces/views.py @@ -190,7 +190,7 @@ class AddInterfaceProfileView(forms.ModalFormView): p.namedisplay = p.get_port_display_name() host.interfaces = stx_api.sysinv.host_interface_list(self.request, - host.uuid) + host.uuid) for i in host.interfaces: i.ports = [p.get_port_display_name() for p in all_ports if @@ -235,7 +235,7 @@ class UpdateView(forms.ModalFormView): host_id = self.kwargs['host_id'] try: self._object = stx_api.sysinv.host_interface_get(self.request, - interface_id) + interface_id) self._object.host_id = host_id except Exception: @@ -355,7 +355,7 @@ class DetailView(tables.MultiTableView): host_id = self.kwargs['host_id'] try: self._object = stx_api.sysinv.host_interface_get(self.request, - interface_id) + interface_id) self._object.host_id = host_id self._object = self._add_pool_names(self._object) except Exception: diff --git a/starlingx_dashboard/dashboards/admin/inventory/memories/views.py b/starlingx_dashboard/dashboards/admin/inventory/memories/views.py index 595e63a7..5976184d 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/memories/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/memories/views.py @@ -38,7 +38,7 @@ class UpdateMemoryView(forms.ModalFormView): try: host = stx_api.sysinv.host_get(self.request, host_id) host.memorys = stx_api.sysinv.host_memory_list(self.request, - host.uuid) + host.uuid) host.nodes = \ stx_api.sysinv.host_node_list(self.request, host.uuid) self._object = host diff --git a/starlingx_dashboard/dashboards/admin/inventory/ports/views.py b/starlingx_dashboard/dashboards/admin/inventory/ports/views.py index 721e8368..d04e8df3 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/ports/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/ports/views.py @@ -86,7 +86,7 @@ class DetailView(views.HorizonTemplateView): host_id = self.kwargs['host_id'] try: self._object = stx_api.sysinv.host_port_get(self.request, - port_id) + port_id) self._object.host_id = host_id except Exception: diff --git a/starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py b/starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py index aeacca51..908487d7 100644 --- a/starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/sensors/forms.py @@ -207,8 +207,8 @@ class UpdateSensorGroup(forms.SelfHandlingForm): try: sensorgroup = stx_api.sysinv.host_sensorgroup_update(request, - sensorgroup_id, - **data) + sensorgroup_id, + **data) msg = _('SensorGroup "%s" was ' 'successfully updated.') % mysensorgroupname diff --git a/starlingx_dashboard/dashboards/admin/inventory/sensors/views.py b/starlingx_dashboard/dashboards/admin/inventory/sensors/views.py index 6b5aa666..ad71b5db 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/sensors/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/sensors/views.py @@ -76,7 +76,7 @@ class UpdateSensorGroupView(forms.ModalFormView): sensorgroup_id, self.kwargs) try: self._object = stx_api.sysinv.host_sensorgroup_get(self.request, - sensorgroup_id) + sensorgroup_id) self._object.host_id = host_id except Exception: @@ -196,7 +196,7 @@ class DetailSensorGroupView(views.HorizonTemplateView): sensorgroup_id = self.kwargs['sensorgroup_id'] try: sensorgroup = stx_api.sysinv.host_sensorgroup_get(self.request, - sensorgroup_id) + sensorgroup_id) except Exception: redirect = reverse('horizon:admin:inventory:index') exceptions.handle(self.request, diff --git a/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py b/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py index 81719591..e3144cbf 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/forms.py @@ -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() @@ -277,7 +277,7 @@ class AddStorageVolume(forms.SelfHandlingForm): # Populate the available tiers for OSD assignment avail_tier_list = stx_api.sysinv.storage_tier_list(self.request, - cluster_uuid) + cluster_uuid) tier_tuple_list = [(t.uuid, t.name) for t in avail_tier_list] # Populate available journal choices. If no journal is available, @@ -559,7 +559,7 @@ class AddPhysicalVolume(forms.SelfHandlingForm): avail_disk_list = stx_api.sysinv.host_disk_list(self.request, host_uuid) ilvg_list = stx_api.sysinv.host_lvg_list(self.request, host_uuid) partitions = stx_api.sysinv.host_disk_partition_list(self.request, - host_uuid) + host_uuid) ipv_list = stx_api.sysinv.host_pv_list(self.request, host_uuid) disk_tuple_list = [] partitions_tuple_list = [] @@ -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 diff --git a/starlingx_dashboard/dashboards/admin/inventory/storages/tables.py b/starlingx_dashboard/dashboards/admin/inventory/storages/tables.py index 83ad2ac0..66f598c8 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/storages/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/tables.py @@ -126,7 +126,7 @@ class DeletePartition(tables.DeleteAction): # Get all the partitions from the same disk. disk_partitions = \ stx_api.sysinv.host_disk_partition_list(request, host.uuid, - partition.idisk_uuid) + partition.idisk_uuid) if partition.device_path: partition_number = re.match('.*?([0-9]+)$', @@ -195,8 +195,8 @@ class EditPartition(tables.LinkAction): # Get all the partitions from the same disk. disk_partitions = \ stx_api.sysinv.host_disk_partition_list(request, - host.uuid, - partition.idisk_uuid) + host.uuid, + partition.idisk_uuid) if partition.device_path: partition_number = re.match('.*?([0-9]+)$', @@ -287,7 +287,7 @@ class EditStor(tables.LinkAction): forihostuuid = self.table.kwargs['host'].uuid journal_stors = \ stx_api.sysinv.host_stor_get_by_function(request, forihostuuid, - 'journal') + 'journal') if not journal_stors: self.classes = [c for c in self.classes] + ['disabled'] @@ -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: diff --git a/starlingx_dashboard/dashboards/admin/inventory/storages/views.py b/starlingx_dashboard/dashboards/admin/inventory/storages/views.py index 73b85187..66360de7 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/storages/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/storages/views.py @@ -86,7 +86,7 @@ class EditStorageVolumeView(forms.ModalFormView): stor_uuid, self.kwargs) try: self._object = stx_api.sysinv.host_stor_get(self.request, - stor_uuid) + stor_uuid) self._object.host_id = host_id except Exception: redirect = reverse("horizon:admin:inventory:detail", diff --git a/starlingx_dashboard/dashboards/admin/inventory/tables.py b/starlingx_dashboard/dashboards/admin/inventory/tables.py index a0354a8c..31e29845 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/tables.py +++ b/starlingx_dashboard/dashboards/admin/inventory/tables.py @@ -837,7 +837,7 @@ class DeleteInterfaceProfile(tables.DeleteAction): def delete(self, request, interfaceprofile_id): try: stx_api.sysinv.host_interfaceprofile_delete(request, - interfaceprofile_id) + interfaceprofile_id) except Exception: msg = _( 'Failed to delete interface profile %s') % interfaceprofile_id diff --git a/starlingx_dashboard/dashboards/admin/inventory/views.py b/starlingx_dashboard/dashboards/admin/inventory/views.py index 61fb2e59..d2de0d3d 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/views.py +++ b/starlingx_dashboard/dashboards/admin/inventory/views.py @@ -116,7 +116,7 @@ class DetailView(tabs.TabbedTableView): icpu_utils.restructure_host_cpu_data(host) host.memorys = stx_api.sysinv.host_memory_list(self.request, - host.uuid) + host.uuid) for m in host.memorys: for n in host.nodes: if m.inode_uuid == n.uuid: @@ -125,9 +125,9 @@ class DetailView(tabs.TabbedTableView): host.ports = stx_api.sysinv.host_port_list(self.request, host.uuid) host.interfaces = stx_api.sysinv.host_interface_list(self.request, - host.uuid) + host.uuid) host.devices = stx_api.sysinv.host_device_list(self.request, - host.uuid) + host.uuid) host.disks = stx_api.sysinv.host_disk_list(self.request, host.uuid) host.stors = stx_api.sysinv.host_stor_list(self.request, host.uuid) host.pvs = stx_api.sysinv.host_pv_list(self.request, host.uuid) @@ -154,7 +154,7 @@ class DetailView(tabs.TabbedTableView): pv.lvm_vg_name) host.lvgs = stx_api.sysinv.host_lvg_list(self.request, host.uuid, - get_params=True) + get_params=True) # Adjust lvg state to be more "user friendly" for lvg in host.lvgs: @@ -162,7 +162,7 @@ class DetailView(tabs.TabbedTableView): lvg.lvm_vg_name) host.sensors = stx_api.sysinv.host_sensor_list(self.request, - host.uuid) + host.uuid) host.sensorgroups = stx_api.sysinv.host_sensorgroup_list( self.request, host.uuid) diff --git a/starlingx_dashboard/dashboards/admin/inventory/workflows.py b/starlingx_dashboard/dashboards/admin/inventory/workflows.py index 2d429978..408950c8 100755 --- a/starlingx_dashboard/dashboards/admin/inventory/workflows.py +++ b/starlingx_dashboard/dashboards/admin/inventory/workflows.py @@ -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 = ( @@ -358,7 +358,7 @@ class UpdateHostInfoAction(workflows.Action): ('', _("Copy from an available cpu profile."))] for ip in avail_cpu_profile_list: nodes = stx_api.sysinv.host_node_list(self.request, - ip.uuid) + ip.uuid) cpu_profile = icpu_utils.CpuProfile(ip.cpus, nodes) if host_profile.profile_applicable(cpu_profile): cpu_profile_tuple_list.append( @@ -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 @@ -773,14 +773,14 @@ class UpdateHost(workflows.Workflow): if data['cpuProfile']: profile_uuid = profile_get_uuid(request, data['cpuProfile']) stx_api.sysinv.host_apply_profile(request, data['host_id'], - profile_uuid) + profile_uuid) data.pop('cpuProfile') if data['interfaceProfile']: profile_uuid = profile_get_uuid(request, data['interfaceProfile']) stx_api.sysinv.host_apply_profile(request, data['host_id'], - profile_uuid) + profile_uuid) data.pop('interfaceProfile') if not data['bm_password']: @@ -789,13 +789,13 @@ class UpdateHost(workflows.Workflow): if data['diskProfile']: profile_uuid = profile_get_uuid(request, data['diskProfile']) stx_api.sysinv.host_apply_profile(request, data['host_id'], - profile_uuid) + profile_uuid) data.pop('diskProfile') if data['memoryProfile']: profile_uuid = profile_get_uuid(request, data['memoryProfile']) stx_api.sysinv.host_apply_profile(request, data['host_id'], - profile_uuid) + profile_uuid) data.pop('memoryProfile') # if not trying to change personality, skip check diff --git a/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py index 1a75f575..c00d9420 100755 --- a/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py +++ b/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/views.py @@ -52,7 +52,7 @@ class CreateView(forms.ModalFormView): try: providernet_id = self.kwargs["providernet_id"] self._object = stx_api.neutron.provider_network_get(self.request, - providernet_id) + providernet_id) except Exception: redirect = reverse(self.failure_url, args=(self.kwargs['providernet_id'],)) @@ -114,7 +114,7 @@ class DetailView(tabs.TabView): def get_providernet_name(self, providernet_id): try: providernet = stx_api.neutron.provider_network_get(self.request, - providernet_id) + providernet_id) providernet.set_id_as_name_if_empty(length=0) except Exception: providernet = {} diff --git a/starlingx_dashboard/dashboards/admin/server_groups/forms.py b/starlingx_dashboard/dashboards/admin/server_groups/forms.py index 3592a164..da3ba7a6 100755 --- a/starlingx_dashboard/dashboards/admin/server_groups/forms.py +++ b/starlingx_dashboard/dashboards/admin/server_groups/forms.py @@ -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")) diff --git a/starlingx_dashboard/dashboards/admin/software_management/tables.py b/starlingx_dashboard/dashboards/admin/software_management/tables.py index f374d4ec..1aab3ee2 100755 --- a/starlingx_dashboard/dashboards/admin/software_management/tables.py +++ b/starlingx_dashboard/dashboards/admin/software_management/tables.py @@ -283,7 +283,7 @@ class DeleteStrategy(tables.Action): def single(self, table, request, obj_id): try: result = stx_api.vim.delete_strategy(request, self.strategy_name, - self.force) + self.force) if result: messages.success(request, "Strategy Deleted") else: @@ -443,7 +443,7 @@ class ApplyStage(tables.BatchAction): try: stage_id = obj_id.split('-', 1)[1] result = stx_api.vim.apply_strategy(request, self.strategy_name, - stage_id) + stage_id) if result is None: messages.error(request, "Strategy stage %s apply failed" % stage_id) @@ -504,7 +504,7 @@ class AbortStage(tables.BatchAction): try: stage_id = obj_id.split('-', 1)[1] result = stx_api.vim.abort_strategy(request, self.strategy_name, - stage_id) + stage_id) if result is None: messages.error(request, "Strategy stage %s abort in progress" % diff --git a/starlingx_dashboard/dashboards/admin/software_management/tabs.py b/starlingx_dashboard/dashboards/admin/software_management/tabs.py index 770627ce..0a572a3d 100755 --- a/starlingx_dashboard/dashboards/admin/software_management/tabs.py +++ b/starlingx_dashboard/dashboards/admin/software_management/tabs.py @@ -101,7 +101,7 @@ class UpgradeOrchestrationTab(tabs.TableTab): strategy = None try: strategy = stx_api.vim.get_strategy(request, - stx_api.vim.STRATEGY_SW_UPGRADE) + stx_api.vim.STRATEGY_SW_UPGRADE) except Exception as ex: LOG.exception(ex) exceptions.handle(request, diff --git a/starlingx_dashboard/dashboards/admin/software_management/views.py b/starlingx_dashboard/dashboards/admin/software_management/views.py index d7056784..a8b1643c 100755 --- a/starlingx_dashboard/dashboards/admin/software_management/views.py +++ b/starlingx_dashboard/dashboards/admin/software_management/views.py @@ -127,7 +127,7 @@ class DetailStageView(tables.DataTableView): stage_id = self.kwargs['stage_id'] try: stage = stx_api.vim.get_stage(self.request, self.strategy_name, - phase, stage_id) + phase, stage_id) stage.timeout_display = \ datetime.timedelta(seconds=stage.timeout) except Exception: diff --git a/starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py b/starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py index 7b7af619..fe11811e 100755 --- a/starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py +++ b/starlingx_dashboard/dashboards/admin/system_config/address_pools/forms.py @@ -126,7 +126,7 @@ class UpdateAddressPool(CreateAddressPool): if data.get('ranges'): updates['ranges'] = data['ranges'] pool = stx_api.sysinv.address_pool_update(request, data['id'], - **updates) + **updates) msg = (_('Address pool was successfully updated')) messages.success(request, msg) return pool diff --git a/starlingx_dashboard/dashboards/admin/system_config/forms.py b/starlingx_dashboard/dashboards/admin/system_config/forms.py index 7826b1e2..61fc48e1 100755 --- a/starlingx_dashboard/dashboards/admin/system_config/forms.py +++ b/starlingx_dashboard/dashboards/admin/system_config/forms.py @@ -184,7 +184,7 @@ class UpdatecDNS(forms.SelfHandlingForm): if send_to_sysinv is True: my_dns = stx_api.sysinv.dns_update(request, - dns_config_uuid, **data) + dns_config_uuid, **data) if my_dns: msg = _('DNS Server was successfully updated.') @@ -494,8 +494,8 @@ class UpdatecEXT_OAM(forms.SelfHandlingForm): LOG.info("OAM sendtosysinv data=%s", data) myoam_data = stx_api.sysinv.extoam_update(self.request, - oam_data_uuid, - **data) + oam_data_uuid, + **data) if myoam_data: msg = _('OAM configuration was successfully updated. ') @@ -619,8 +619,8 @@ class UpdateiStorage(forms.SelfHandlingForm): if new_data: my_storage = stx_api.sysinv.storfs_update_many(request, - system_uuid, - **new_data) + system_uuid, + **new_data) return True except exc.ClientException as ce: @@ -706,7 +706,7 @@ class UpdateiStoragePools(forms.SelfHandlingForm): data['uuid'] = ' ' storage_config = stx_api.sysinv.storagepool_get(request, - data['uuid']) + data['uuid']) data.pop('uuid') if hasattr(storage_config, 'uuid'): @@ -750,8 +750,8 @@ class UpdateiStoragePools(forms.SelfHandlingForm): if send_to_sysinv: my_storage = stx_api.sysinv.storpool_update(request, - storage_config_uuid, - **data) + storage_config_uuid, + **data) if my_storage: msg = _( diff --git a/starlingx_dashboard/dashboards/admin/system_config/views.py b/starlingx_dashboard/dashboards/admin/system_config/views.py index 02a3175c..13ea338d 100755 --- a/starlingx_dashboard/dashboards/admin/system_config/views.py +++ b/starlingx_dashboard/dashboards/admin/system_config/views.py @@ -344,7 +344,7 @@ class DetailSDNControllerView(tables.DataTableView): uuid = self.kwargs['uuid'] try: self._object = stx_api.sysinv.sdn_controller_get(self.request, - uuid) + uuid) except Exception: redirect = self.failure_url msg = _("Unable to retrieve details for " @@ -384,7 +384,7 @@ class UpdateSDNControllerView(forms.ModalFormView): controller_uuid = self.kwargs['uuid'] try: self._object = stx_api.sysinv.sdn_controller_get(self.request, - controller_uuid) + controller_uuid) except Exception: redirect = self.success_url msg = _('Unable to retrieve SDN controller details.') diff --git a/starlingx_dashboard/dashboards/project/server_groups/forms.py b/starlingx_dashboard/dashboards/project/server_groups/forms.py index 8212c7c5..2283066b 100755 --- a/starlingx_dashboard/dashboards/project/server_groups/forms.py +++ b/starlingx_dashboard/dashboards/project/server_groups/forms.py @@ -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"), @@ -95,7 +94,7 @@ class CreateForm(forms.SelfHandlingForm): 'policies': policies, 'metadata': metadata, 'project_id': project_id} - + server_group = stx_nova.server_group_create(request, **kwargs) return server_group diff --git a/starlingx_dashboard/dashboards/project/server_groups/tabs.py b/starlingx_dashboard/dashboards/project/server_groups/tabs.py index f33f55a1..fea88bcf 100755 --- a/starlingx_dashboard/dashboards/project/server_groups/tabs.py +++ b/starlingx_dashboard/dashboards/project/server_groups/tabs.py @@ -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" diff --git a/starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py b/starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py index a0e0dbb7..647551f4 100755 --- a/starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py +++ b/starlingx_dashboard/enabled/_2032_starlingx_admin_fault_management_panel.py @@ -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' - diff --git a/starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py b/starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py index 58fda97f..d7257a50 100755 --- a/starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py +++ b/starlingx_dashboard/enabled/_2034_starlingx_platform_software_management_panel.py @@ -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' - diff --git a/starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py b/starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py index e054d666..bf6fc2c1 100755 --- a/starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py +++ b/starlingx_dashboard/enabled/_2035_starlingx_admin_inventory_panel.py @@ -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' - diff --git a/starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py b/starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py index 8d449abc..5b73fdf5 100755 --- a/starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py +++ b/starlingx_dashboard/enabled/_2038_starlingx_platform_storage_overview_panel.py @@ -7,4 +7,4 @@ PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. ADD_PANEL = 'starlingx_dashboard.dashboards.admin.storage_overview.' \ - 'panel.StorageOverview' \ No newline at end of file + 'panel.StorageOverview' diff --git a/starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py b/starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py index a2b2e403..b3c98adb 100755 --- a/starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py +++ b/starlingx_dashboard/enabled/_2039_starlingx_admin_system_config.py @@ -7,4 +7,4 @@ PANEL_GROUP = 'platform' # Python panel class of the PANEL to be added. ADD_PANEL = ('starlingx_dashboard.dashboards.admin.' - 'system_config.panel.SystemConfig') \ No newline at end of file + 'system_config.panel.SystemConfig') diff --git a/starlingx_dashboard/horizon/tables/__init__.py b/starlingx_dashboard/horizon/tables/__init__.py index 92dfa01c..ad2041f9 100644 --- a/starlingx_dashboard/horizon/tables/__init__.py +++ b/starlingx_dashboard/horizon/tables/__init__.py @@ -1,2 +1,2 @@ from starlingx_dashboard.stx_horizon.tables.actions import FixedWithQueryFilter -from starlingx_dashboard.stx_horizon.tables.actions import LimitAction \ No newline at end of file +from starlingx_dashboard.stx_horizon.tables.actions import LimitAction diff --git a/starlingx_dashboard/horizon/tables/actions.py b/starlingx_dashboard/horizon/tables/actions.py index 85edf45c..b2b19100 100644 --- a/starlingx_dashboard/horizon/tables/actions.py +++ b/starlingx_dashboard/horizon/tables/actions.py @@ -1,7 +1,7 @@ -# -# Copyright (c) 2018 Intel Corporation -# -# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 # from collections import OrderedDict @@ -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. @@ -193,4 +194,4 @@ class LimitAction(BaseAction): limits = {} for count in self.limits: limits[count] = self.get_limit_name(count) - return OrderedDict(sorted(limits.items(), key=lambda limit: limit[0])) \ No newline at end of file + return OrderedDict(sorted(limits.items(), key=lambda limit: limit[0])) diff --git a/starlingx_dashboard/usage/quotas.py b/starlingx_dashboard/usage/quotas.py index 49235aac..cb7c128d 100644 --- a/starlingx_dashboard/usage/quotas.py +++ b/starlingx_dashboard/usage/quotas.py @@ -1,5 +1,5 @@ -# -# Copyright (c) 2018 Intel Corporation -# -# SPDX-License-Identifier: Apache-2.0 -# \ No newline at end of file +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# diff --git a/starlingx_dashboard/version.py b/starlingx_dashboard/version.py index 30f8f2ed..8b5a5a55 100755 --- a/starlingx_dashboard/version.py +++ b/starlingx_dashboard/version.py @@ -14,4 +14,4 @@ from pbr import version version_info = version.VersionInfo('starlingx_dashboard') -__version__ = version_info.cached_version_string() \ No newline at end of file +__version__ = version_info.cached_version_string() diff --git a/tox.ini b/tox.ini index 1523066f..26ef8429 100644 --- a/tox.ini +++ b/tox.ini @@ -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