Enable zuul unit tests for stx-gui
Enable pylint and fix tox errors resulting from that. Story: 2003863 Task: 27931 Change-Id: I3455f29ec182ed91966d4724cf49dceb314a1387 Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
parent
4f0afaf708
commit
e79dcfae87
14
.zuul.yaml
14
.zuul.yaml
@ -7,12 +7,26 @@
|
|||||||
- build-openstack-releasenotes
|
- build-openstack-releasenotes
|
||||||
- openstack-tox-pep8
|
- openstack-tox-pep8
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
|
- stx-gui-pylint
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- build-openstack-releasenotes
|
- build-openstack-releasenotes
|
||||||
- openstack-tox-pep8
|
- openstack-tox-pep8
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
|
- stx-gui-pylint
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- publish-stx-tox
|
- publish-stx-tox
|
||||||
- publish-stx-releasenotes
|
- publish-stx-releasenotes
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: stx-gui-pylint
|
||||||
|
parent: openstack-tox-pylint
|
||||||
|
description: Run pylint for stx-gui
|
||||||
|
vars:
|
||||||
|
tox_envlist: pylint
|
||||||
|
required-projects:
|
||||||
|
- openstack/stx-config
|
||||||
|
- openstack/stx-fault
|
||||||
|
- openstack/stx-update
|
||||||
|
- openstack/stx-nfv
|
224
pylint.rc
Executable file
224
pylint.rc
Executable file
@ -0,0 +1,224 @@
|
|||||||
|
[MASTER]
|
||||||
|
# Specify a configuration file.
|
||||||
|
rcfile=pylint.rc
|
||||||
|
|
||||||
|
# Python code to execute, usually for sys.path manipulation such as pygtk.require().
|
||||||
|
#init-hook=
|
||||||
|
|
||||||
|
# Add files or directories to the blacklist. They should be base names, not paths.
|
||||||
|
#ignore=
|
||||||
|
|
||||||
|
# Pickle collected data for later comparisons.
|
||||||
|
persistent=yes
|
||||||
|
|
||||||
|
# List of plugins (as comma separated values of python modules names) to load,
|
||||||
|
# usually to register additional checkers.
|
||||||
|
load-plugins=
|
||||||
|
|
||||||
|
|
||||||
|
[MESSAGES CONTROL]
|
||||||
|
# Enable the message, report, category or checker with the given id(s). You can
|
||||||
|
# either give multiple identifier separated by comma (,) or put this option
|
||||||
|
# multiple time.
|
||||||
|
#enable=
|
||||||
|
|
||||||
|
# Disable the message, report, category or checker with the given id(s). You
|
||||||
|
# can either give multiple identifier separated by comma (,) or put this option
|
||||||
|
# multiple time (only on the command line, not in the configuration file where
|
||||||
|
# it should appear only once).
|
||||||
|
# W0201 attribute-defined-outside-init
|
||||||
|
# W0212 protected-access var starting with _ used outside class or descendant
|
||||||
|
# W0221 arguments-differ
|
||||||
|
# W0222 signature-differs
|
||||||
|
# W0235 useless-super-delegation
|
||||||
|
# W0403 relative-import warning
|
||||||
|
# W0511 fixme
|
||||||
|
# W0613 Unused argument warning
|
||||||
|
# W0703 broad except warning
|
||||||
|
# E0202 method-hidden
|
||||||
|
# E0203 access-member-before-definition
|
||||||
|
# E1101 no-member
|
||||||
|
disable=C, R, W0201, W0212, W0221, W0222, W0235, W0403, W0511, W0613, W0703,
|
||||||
|
E0202, E0203, E1101
|
||||||
|
|
||||||
|
|
||||||
|
[REPORTS]
|
||||||
|
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||||
|
# (visual studio) and html
|
||||||
|
output-format=text
|
||||||
|
|
||||||
|
# Put messages in a separate file for each module / package specified on the
|
||||||
|
# command line instead of printing them on stdout. Reports (if any) will be
|
||||||
|
# written in a file name "pylint_global.[txt|html]".
|
||||||
|
files-output=no
|
||||||
|
|
||||||
|
# Tells whether to display a full report or only the messages
|
||||||
|
reports=no
|
||||||
|
|
||||||
|
# Python expression which should return a note less than 10 (10 is the highest
|
||||||
|
# note). You have access to the variables errors warning, statement which
|
||||||
|
# respectively contain the number of errors / warnings messages and the total
|
||||||
|
# number of statements analyzed. This is used by the global evaluation report
|
||||||
|
# (RP0004).
|
||||||
|
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||||
|
|
||||||
|
|
||||||
|
[SIMILARITIES]
|
||||||
|
# Minimum lines number of a similarity.
|
||||||
|
min-similarity-lines=4
|
||||||
|
|
||||||
|
# Ignore comments when computing similarities.
|
||||||
|
ignore-comments=yes
|
||||||
|
|
||||||
|
# Ignore docstrings when computing similarities.
|
||||||
|
ignore-docstrings=yes
|
||||||
|
|
||||||
|
|
||||||
|
[FORMAT]
|
||||||
|
# Maximum number of characters on a single line.
|
||||||
|
max-line-length=85
|
||||||
|
|
||||||
|
# Maximum number of lines in a module
|
||||||
|
max-module-lines=1000
|
||||||
|
|
||||||
|
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab).
|
||||||
|
indent-string=' '
|
||||||
|
|
||||||
|
|
||||||
|
[TYPECHECK]
|
||||||
|
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||||
|
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||||
|
ignore-mixin-members=yes
|
||||||
|
|
||||||
|
# List of classes names for which member attributes should not be checked
|
||||||
|
# (useful for classes with attributes dynamically set).
|
||||||
|
ignored-classes=SQLObject,sqlalchemy,scoped_session,_socketobject,ObjectData,GuestService,Network,SwUpdate
|
||||||
|
|
||||||
|
# List of members which are set dynamically and missed by pylint inference
|
||||||
|
# system, and so shouldn't trigger E0201 when accessed. Python regular
|
||||||
|
# expressions are accepted.
|
||||||
|
generated-members=REQUEST,acl_users,aq_parent
|
||||||
|
|
||||||
|
[BASIC]
|
||||||
|
# List of builtins function names that should not be used, separated by a comma
|
||||||
|
bad-functions=map,filter,apply,input
|
||||||
|
|
||||||
|
# Regular expression which should only match correct module names
|
||||||
|
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct module level names
|
||||||
|
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct class names
|
||||||
|
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct function names
|
||||||
|
function-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct method names
|
||||||
|
method-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct instance attribute names
|
||||||
|
attr-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct argument names
|
||||||
|
argument-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct variable names
|
||||||
|
variable-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression which should only match correct list comprehension /
|
||||||
|
# generator expression variable names
|
||||||
|
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||||
|
|
||||||
|
# Good variable names which should always be accepted, separated by a comma
|
||||||
|
good-names=i,j,k,ex,Run,_
|
||||||
|
|
||||||
|
# Bad variable names which should always be refused, separated by a comma
|
||||||
|
bad-names=foo,bar,baz,toto,tutu,tata
|
||||||
|
|
||||||
|
# Regular expression which should only match functions or classes name which do
|
||||||
|
# not require a docstring
|
||||||
|
no-docstring-rgx=__.*__
|
||||||
|
|
||||||
|
|
||||||
|
[MISCELLANEOUS]
|
||||||
|
# List of note tags to take in consideration, separated by a comma.
|
||||||
|
notes=FIXME,XXX,TODO
|
||||||
|
|
||||||
|
|
||||||
|
[VARIABLES]
|
||||||
|
# Tells whether we should check for unused import in __init__ files.
|
||||||
|
init-import=no
|
||||||
|
|
||||||
|
# A regular expression matching the beginning of the name of dummy variables
|
||||||
|
# (i.e. not used).
|
||||||
|
dummy-variables-rgx=_|dummy
|
||||||
|
|
||||||
|
# List of additional names supposed to be defined in builtins. Remember that
|
||||||
|
# you should avoid to define new builtins when possible.
|
||||||
|
additional-builtins=
|
||||||
|
|
||||||
|
|
||||||
|
[IMPORTS]
|
||||||
|
# Deprecated modules which should not be used, separated by a comma
|
||||||
|
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
|
||||||
|
|
||||||
|
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||||
|
# given file (report RP0402 must not be disabled)
|
||||||
|
import-graph=
|
||||||
|
|
||||||
|
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||||
|
# not be disabled)
|
||||||
|
ext-import-graph=
|
||||||
|
|
||||||
|
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||||
|
# not be disabled)
|
||||||
|
int-import-graph=
|
||||||
|
|
||||||
|
|
||||||
|
[DESIGN]
|
||||||
|
# Maximum number of arguments for function / method
|
||||||
|
max-args=5
|
||||||
|
|
||||||
|
# Argument names that match this expression will be ignored. Default to name
|
||||||
|
# with leading underscore
|
||||||
|
ignored-argument-names=_.*
|
||||||
|
|
||||||
|
# Maximum number of locals for function / method body
|
||||||
|
max-locals=15
|
||||||
|
|
||||||
|
# Maximum number of return / yield for function / method body
|
||||||
|
max-returns=6
|
||||||
|
|
||||||
|
# Maximum number of branch for function / method body
|
||||||
|
max-branchs=12
|
||||||
|
|
||||||
|
# Maximum number of statements in function / method body
|
||||||
|
max-statements=50
|
||||||
|
|
||||||
|
# Maximum number of parents for a class (see R0901).
|
||||||
|
max-parents=7
|
||||||
|
|
||||||
|
# Maximum number of attributes for a class (see R0902).
|
||||||
|
max-attributes=7
|
||||||
|
|
||||||
|
# Minimum number of public methods for a class (see R0903).
|
||||||
|
min-public-methods=2
|
||||||
|
|
||||||
|
# Maximum number of public methods for a class (see R0904).
|
||||||
|
max-public-methods=20
|
||||||
|
|
||||||
|
|
||||||
|
[CLASSES]
|
||||||
|
# List of method names used to declare (i.e. assign) instance attributes.
|
||||||
|
defining-attr-methods=__init__,__new__,setUp
|
||||||
|
|
||||||
|
# List of valid names for the first argument in a class method.
|
||||||
|
valid-classmethod-first-arg=cls
|
||||||
|
|
||||||
|
|
||||||
|
[EXCEPTIONS]
|
||||||
|
# Exceptions that will emit a warning when being caught. Defaults to
|
||||||
|
# "Exception"
|
||||||
|
overgeneral-exceptions=Exception
|
@ -1,2 +1,2 @@
|
|||||||
SRC_DIR="starlingx-dashboard"
|
SRC_DIR="starlingx-dashboard"
|
||||||
TIS_PATCH_VER=17
|
TIS_PATCH_VER=20
|
||||||
|
@ -64,9 +64,9 @@ def provider_network_modify(request, providernet_id, **kwargs):
|
|||||||
|
|
||||||
def provider_network_range_create(request, **kwargs):
|
def provider_network_range_create(request, **kwargs):
|
||||||
body = {'providernet_range': kwargs}
|
body = {'providernet_range': kwargs}
|
||||||
range = neutronclient(request).create_providernet_range(body=body).get(
|
_range = neutronclient(request).create_providernet_range(body=body).get(
|
||||||
'providernet_range')
|
'providernet_range')
|
||||||
return ProviderNetworkRange(range)
|
return ProviderNetworkRange(_range)
|
||||||
|
|
||||||
|
|
||||||
def provider_network_range_list(request, **params):
|
def provider_network_range_list(request, **params):
|
||||||
@ -77,9 +77,9 @@ def provider_network_range_list(request, **params):
|
|||||||
|
|
||||||
def provider_network_range_get(request, range_id,
|
def provider_network_range_get(request, range_id,
|
||||||
expand_subnet=True, **params):
|
expand_subnet=True, **params):
|
||||||
range = neutronclient(request).show_providernet_range(
|
_range = neutronclient(request).show_providernet_range(
|
||||||
range_id, **params).get('providernet_range')
|
range_id, **params).get('providernet_range')
|
||||||
return ProviderNetworkRange(range)
|
return ProviderNetworkRange(_range)
|
||||||
|
|
||||||
|
|
||||||
def provider_network_range_delete(request, range_id):
|
def provider_network_range_delete(request, range_id):
|
||||||
@ -88,9 +88,9 @@ def provider_network_range_delete(request, range_id):
|
|||||||
|
|
||||||
def provider_network_range_modify(request, range_id, **kwargs):
|
def provider_network_range_modify(request, range_id, **kwargs):
|
||||||
body = {'providernet_range': kwargs}
|
body = {'providernet_range': kwargs}
|
||||||
range = neutronclient(request).update_providernet_range(
|
_range = neutronclient(request).update_providernet_range(
|
||||||
range_id, body=body).get('providernet_range')
|
range_id, body=body).get('providernet_range')
|
||||||
return ProviderNetworkRange(range)
|
return ProviderNetworkRange(_range)
|
||||||
|
|
||||||
|
|
||||||
def qos_list(request):
|
def qos_list(request):
|
||||||
|
@ -64,8 +64,8 @@ class Client(object):
|
|||||||
return self._make_request(self.token_id, "GET", self.version,
|
return self._make_request(self.token_id, "GET", self.version,
|
||||||
"query_hosts")
|
"query_hosts")
|
||||||
|
|
||||||
def upload(self, file):
|
def upload(self, patchfile):
|
||||||
encoder = MultipartEncoder(fields=file)
|
encoder = MultipartEncoder(fields=patchfile)
|
||||||
return self._make_request(self.token_id, "POST", self.version,
|
return self._make_request(self.token_id, "POST", self.version,
|
||||||
"upload", encoder=encoder)
|
"upload", encoder=encoder)
|
||||||
|
|
||||||
@ -206,8 +206,8 @@ def get_message(data):
|
|||||||
|
|
||||||
|
|
||||||
def upload_patch(request, patchfile, name):
|
def upload_patch(request, patchfile, name):
|
||||||
file = {'file': (name, patchfile,)}
|
_file = {'file': (name, patchfile,)}
|
||||||
resp = _patching_client(request).upload(file)
|
resp = _patching_client(request).upload(_file)
|
||||||
return get_message(resp)
|
return get_message(resp)
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class UnsuppressEvent(tables.BatchAction):
|
|||||||
|
|
||||||
class EventsSuppressionTable(tables.DataTable):
|
class EventsSuppressionTable(tables.DataTable):
|
||||||
# noinspection PyMethodParameters
|
# noinspection PyMethodParameters
|
||||||
def description_inject(row_data):
|
def description_inject(row_data): # pylint: disable=no-self-argument
|
||||||
description = \
|
description = \
|
||||||
escape_html(str(row_data.description)).replace("\n", "<br/>")
|
escape_html(str(row_data.description)).replace("\n", "<br/>")
|
||||||
description = description.replace("\t", " ")
|
description = description.replace("\t", " ")
|
||||||
|
@ -115,7 +115,7 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||||||
search_opts = {}
|
search_opts = {}
|
||||||
# get retrieve parameters from request/session env
|
# get retrieve parameters from request/session env
|
||||||
limit = \
|
limit = \
|
||||||
self.request.GET.get(tables.AlarmsTable._meta.limit_param,
|
self.request.GET.get(tables.AlarmsTable.Meta.limit_param,
|
||||||
None)
|
None)
|
||||||
|
|
||||||
search_opts = self.get_filters()
|
search_opts = self.get_filters()
|
||||||
@ -150,8 +150,8 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||||||
event_types = self.tab_group.kwargs['suppression_list']
|
event_types = self.tab_group.kwargs['suppression_list']
|
||||||
except Exception:
|
except Exception:
|
||||||
exceptions.handle(self.request,
|
exceptions.handle(self.request,
|
||||||
_('Unable to retrieve event suppression table \ '
|
_('Unable to retrieve event suppression table'
|
||||||
'list.'))
|
' list.'))
|
||||||
return event_types
|
return event_types
|
||||||
|
|
||||||
|
|
||||||
@ -236,10 +236,10 @@ class EventLogTab(tabs.TableTab):
|
|||||||
|
|
||||||
# get retrieve parameters from request/session env
|
# get retrieve parameters from request/session env
|
||||||
marker = \
|
marker = \
|
||||||
self.request.GET.get(tables.EventLogsTable._meta.pagination_param,
|
self.request.GET.get(tables.EventLogsTable.Meta.pagination_param,
|
||||||
None)
|
None)
|
||||||
limit = \
|
limit = \
|
||||||
self.request.GET.get(tables.EventLogsTable._meta.limit_param,
|
self.request.GET.get(tables.EventLogsTable.Meta.limit_param,
|
||||||
None)
|
None)
|
||||||
search_opts = self.get_filters({'marker': marker,
|
search_opts = self.get_filters({'marker': marker,
|
||||||
'limit': limit,
|
'limit': limit,
|
||||||
|
@ -135,7 +135,7 @@ class BannerView(TemplateView):
|
|||||||
template_name = 'header/_alarm_banner.html'
|
template_name = 'header/_alarm_banner.html'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(TemplateView, self).get_context_data(**kwargs)
|
context = super(BannerView, self).get_context_data(**kwargs)
|
||||||
|
|
||||||
if not self.request.is_ajax():
|
if not self.request.is_ajax():
|
||||||
raise exceptions.NotFound()
|
raise exceptions.NotFound()
|
||||||
|
@ -28,9 +28,9 @@ LOG = logging.getLogger(__name__)
|
|||||||
def get_alarms_for_entity(alarms, entity_str):
|
def get_alarms_for_entity(alarms, entity_str):
|
||||||
matched = []
|
matched = []
|
||||||
for alarm in alarms:
|
for alarm in alarms:
|
||||||
for id in alarm.entity_instance_id.split('.'):
|
for _id in alarm.entity_instance_id.split('.'):
|
||||||
try:
|
try:
|
||||||
if entity_str == id.split('=')[1]:
|
if entity_str == _id.split('=')[1]:
|
||||||
matched.append(alarm)
|
matched.append(alarm)
|
||||||
except Exception:
|
except Exception:
|
||||||
# malformed entity_instance_id
|
# malformed entity_instance_id
|
||||||
@ -73,7 +73,7 @@ class OverviewTab(tabs.TableTab):
|
|||||||
def _get_tenant_list(self):
|
def _get_tenant_list(self):
|
||||||
if not hasattr(self, "_tenants"):
|
if not hasattr(self, "_tenants"):
|
||||||
try:
|
try:
|
||||||
tenants, has_more = api.keystone.tenant_list(self.request)
|
tenants, has_more = api.keystone.tenant_list(self.request) # noqa pylint: disable=unused-variable
|
||||||
except Exception:
|
except Exception:
|
||||||
tenants = []
|
tenants = []
|
||||||
msg = _('Unable to retrieve instance project information.')
|
msg = _('Unable to retrieve instance project information.')
|
||||||
|
@ -140,10 +140,10 @@ class UsageView(tables.MultiTableView):
|
|||||||
try:
|
try:
|
||||||
_object = stx_api.nova.get_detail_usage(self.request, dev_id)
|
_object = stx_api.nova.get_detail_usage(self.request, dev_id)
|
||||||
_object.sort(key=lambda f: (f.host))
|
_object.sort(key=lambda f: (f.host))
|
||||||
id = 0
|
_id = 0
|
||||||
for u in _object:
|
for u in _object:
|
||||||
id += 1
|
_id += 1
|
||||||
u.id = id
|
u.id = _id
|
||||||
self._detail_object = _object
|
self._detail_object = _object
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -269,10 +269,12 @@ class UpdateMemory(forms.SelfHandlingForm):
|
|||||||
try:
|
try:
|
||||||
for nd in node:
|
for nd in node:
|
||||||
node_found = False
|
node_found = False
|
||||||
|
memory = None
|
||||||
for m in self.host.memorys:
|
for m in self.host.memorys:
|
||||||
for n in self.host.nodes:
|
for n in self.host.nodes:
|
||||||
if m.inode_uuid == n.uuid:
|
if m.inode_uuid == n.uuid:
|
||||||
if int(n.numa_node) == int(node.index(nd)):
|
if int(n.numa_node) == int(node.index(nd)):
|
||||||
|
memory = m
|
||||||
node_found = True
|
node_found = True
|
||||||
break
|
break
|
||||||
if node_found:
|
if node_found:
|
||||||
@ -288,7 +290,7 @@ class UpdateMemory(forms.SelfHandlingForm):
|
|||||||
new_data['vm_hugepages_nr_1G_pending'] = pages_1G[nd]
|
new_data['vm_hugepages_nr_1G_pending'] = pages_1G[nd]
|
||||||
|
|
||||||
if new_data:
|
if new_data:
|
||||||
stx_api.sysinv.host_memory_update(request, m.uuid,
|
stx_api.sysinv.host_memory_update(request, memory.uuid,
|
||||||
**new_data)
|
**new_data)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -296,7 +296,7 @@ class ParamForm(ParamMixin, forms.SelfHandlingForm):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(EditParam, self).get_context_data(**kwargs)
|
context = super(ParamForm, self).get_context_data(**kwargs)
|
||||||
context.update(self._lvg)
|
context.update(self._lvg)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class EditView(forms.ModalFormView):
|
|||||||
success_url = 'horizon:admin:inventory:localvolumegroupdetail'
|
success_url = 'horizon:admin:inventory:localvolumegroupdetail'
|
||||||
|
|
||||||
def get_form(self, form_class):
|
def get_form(self, form_class):
|
||||||
self.form = super(self.__class__, self).get_form(form_class)
|
self.form = super(EditView, self).get_form(form_class)
|
||||||
return self.form
|
return self.form
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
@ -124,10 +124,9 @@ def profile_get_uuid(request, profilename):
|
|||||||
|
|
||||||
for iprofile in profiles:
|
for iprofile in profiles:
|
||||||
if iprofile.profilename == profilename:
|
if iprofile.profilename == profilename:
|
||||||
break
|
return iprofile.uuid
|
||||||
else:
|
|
||||||
raise forms.ValidationError("Profile not found: %s" % profilename)
|
raise forms.ValidationError("Profile not found: %s" % profilename)
|
||||||
return iprofile.uuid
|
|
||||||
|
|
||||||
|
|
||||||
class AddHostInfoAction(workflows.Action):
|
class AddHostInfoAction(workflows.Action):
|
||||||
|
@ -103,7 +103,7 @@ class CreateProviderNetworkRange(forms.SelfHandlingForm):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
tenant_choices = [('', _("Select a project"))]
|
tenant_choices = [('', _("Select a project"))]
|
||||||
tenants, has_more = api.keystone.tenant_list(request)
|
tenants, has_more = api.keystone.tenant_list(request) # noqa pylint: disable=unused-variable
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
if tenant.enabled:
|
if tenant.enabled:
|
||||||
tenant_choices.append((tenant.id, tenant.name))
|
tenant_choices.append((tenant.id, tenant.name))
|
||||||
|
@ -58,7 +58,7 @@ class DetailView(tables.MultiTableView):
|
|||||||
def _get_tenant_list(self):
|
def _get_tenant_list(self):
|
||||||
if not hasattr(self, "_tenants"):
|
if not hasattr(self, "_tenants"):
|
||||||
try:
|
try:
|
||||||
tenants, has_more = api.keystone.tenant_list(self.request)
|
tenants, has_more = api.keystone.tenant_list(self.request) # noqa pylint: disable=unused-variable
|
||||||
except Exception:
|
except Exception:
|
||||||
tenants = []
|
tenants = []
|
||||||
msg = _('Unable to retrieve instance project information.')
|
msg = _('Unable to retrieve instance project information.')
|
||||||
|
@ -78,7 +78,7 @@ class CreateForm(forms.SelfHandlingForm):
|
|||||||
all_projects = []
|
all_projects = []
|
||||||
try:
|
try:
|
||||||
# Get list of available projects.
|
# Get list of available projects.
|
||||||
all_projects, has_more = api.keystone.tenant_list(request)
|
all_projects, has_more = api.keystone.tenant_list(request) # noqa pylint: disable=unused-variable
|
||||||
|
|
||||||
projects_list = [(project.id, project.name)
|
projects_list = [(project.id, project.name)
|
||||||
for project in all_projects]
|
for project in all_projects]
|
||||||
|
@ -106,7 +106,7 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView):
|
|||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
try:
|
try:
|
||||||
instances, has_more = api.nova.server_list(self.request)
|
instances, has_more = api.nova.server_list(self.request) # noqa pylint: disable=unused-variable
|
||||||
except Exception:
|
except Exception:
|
||||||
instances = []
|
instances = []
|
||||||
exceptions.handle(self.request,
|
exceptions.handle(self.request,
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse # noqa
|
|
||||||
from django.core.urlresolvers import reverse_lazy
|
from django.core.urlresolvers import reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
import horizon
|
import horizon
|
||||||
|
|
||||||
# Load the api rest services into Horizon
|
# Load the api rest services into Horizon
|
||||||
import starlingx_dashboard.api.rest # noqa
|
import starlingx_dashboard.api.rest # noqa: F401 pylint: disable=unused-import
|
||||||
|
|
||||||
|
|
||||||
class DCAdmin(horizon.Dashboard):
|
class DCAdmin(horizon.Dashboard):
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse # noqa
|
from django.core.urlresolvers import reverse # noqa
|
||||||
from django.template.defaultfilters import safe, title # noqa
|
from django.template.defaultfilters import safe
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ungettext_lazy
|
from django.utils.translation import ungettext_lazy
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ DELETABLE_STATES = ("available", "error")
|
|||||||
class DeleteServerGroup(tables.DeleteAction):
|
class DeleteServerGroup(tables.DeleteAction):
|
||||||
data_type_singular = _("Server Group")
|
data_type_singular = _("Server Group")
|
||||||
data_type_plural = _("Server Groups")
|
data_type_plural = _("Server Groups")
|
||||||
action_past = _("Scheduled deletion of")
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def action_present(count):
|
def action_present(count):
|
||||||
@ -213,8 +212,6 @@ class ServerGroupsTable(tables.DataTable):
|
|||||||
|
|
||||||
class DetachServerGroup(tables.BatchAction):
|
class DetachServerGroup(tables.BatchAction):
|
||||||
name = "detach"
|
name = "detach"
|
||||||
action_present = _("Detach")
|
|
||||||
action_past = _("Detaching") # This action is asynchronous.
|
|
||||||
data_type_singular = _("Server Group")
|
data_type_singular = _("Server Group")
|
||||||
data_type_plural = _("Server Groups")
|
data_type_plural = _("Server Groups")
|
||||||
classes = ('btn-danger', 'btn-detach')
|
classes = ('btn-danger', 'btn-detach')
|
||||||
|
@ -106,7 +106,7 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView):
|
|||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
try:
|
try:
|
||||||
instances, has_more = api.nova.server_list(self.request)
|
instances, has_more = api.nova.server_list(self.request) # noqa pylint: disable=unused-variable
|
||||||
except Exception:
|
except Exception:
|
||||||
instances = []
|
instances = []
|
||||||
exceptions.handle(self.request,
|
exceptions.handle(self.request,
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
from starlingx_dashboard.stx_horizon.tables.actions import FixedWithQueryFilter # noqa
|
from starlingx_dashboard.horizon.tables.actions import FixedWithQueryFilter # noqa
|
||||||
from starlingx_dashboard.stx_horizon.tables.actions import LimitAction # noqa
|
from starlingx_dashboard.horizon.tables.actions import LimitAction # noqa
|
||||||
|
22
tox.ini
22
tox.ini
@ -2,6 +2,7 @@
|
|||||||
envlist = pep8
|
envlist = pep8
|
||||||
minversion = 2.3
|
minversion = 2.3
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
stxdir = {toxinidir}/..
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
install_command = pip install -U {opts} {packages}
|
install_command = pip install -U {opts} {packages}
|
||||||
@ -54,6 +55,27 @@ deps =
|
|||||||
commands =
|
commands =
|
||||||
flake8
|
flake8
|
||||||
|
|
||||||
|
[testenv:pylint]
|
||||||
|
basepython = python2.7
|
||||||
|
usedevelop = False
|
||||||
|
skip_install = True
|
||||||
|
deps = {[testenv]deps}
|
||||||
|
git+git://github.com/starlingx-staging/stx-python-novaclient.git
|
||||||
|
git+git://github.com/starlingx-staging/stx-python-neutronclient.git
|
||||||
|
git+git://github.com/starlingx-staging/stx-horizon.git
|
||||||
|
git+git://github.com/starlingx-staging/stx-distcloud-client.git
|
||||||
|
-e{[tox]stxdir}/stx-config/sysinv/cgts-client/cgts-client
|
||||||
|
-e{[tox]stxdir}/stx-config/sysinv/sysinv/sysinv
|
||||||
|
-e{[tox]stxdir}/stx-fault/python-fmclient/fmclient
|
||||||
|
-e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch
|
||||||
|
-e{[tox]stxdir}/stx-nfv/nfv/nfv-client
|
||||||
|
requests-toolbelt
|
||||||
|
pylint
|
||||||
|
commands =
|
||||||
|
pylint --rcfile=./pylint.rc --version
|
||||||
|
pylint starlingx-dashboard/starlingx-dashboard/starlingx_dashboard \
|
||||||
|
--rcfile=./pylint.rc
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user