Enable Pylint E020X Errors
Pylint currently ignores the following errors: E0202: method-hidden E0203: access-member-before-definition Enable them to improve code linting Remove MutexTransactionHook as it is no longer being used and triggers the above pylint errors Change-Id: If3a0fe0c6d31712d552b83b5e33d920c83fcbe13 Story: 2004515 Task: 28687 Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
This commit is contained in:
parent
635f540a16
commit
ef64f030d8
@ -68,8 +68,6 @@ load-plugins=
|
||||
# W1401: anomalous-backslash-in-string
|
||||
# W1505: deprecated-method
|
||||
# All these errors should be fixed:
|
||||
# E0202: method-hidden
|
||||
# E0203: access-member-before-definition
|
||||
# E0213: no-self-argument
|
||||
# E0401: import-error
|
||||
# E0604: invalid-all-object
|
||||
|
@ -44,8 +44,7 @@ def get_pecan_config():
|
||||
def setup_app(pecan_config=None, extra_hooks=None):
|
||||
policy.init()
|
||||
|
||||
# hooks.DBTransactionHook(),
|
||||
# hooks.MutexTransactionHook(),
|
||||
# hooks.DBTransactionHook()
|
||||
app_hooks = [hooks.ConfigHook(),
|
||||
hooks.DBHook(),
|
||||
hooks.ContextHook(pecan_config.app.acl_public_routes),
|
||||
|
@ -36,7 +36,6 @@ from webob import exc
|
||||
|
||||
from sysinv.openstack.common import log
|
||||
from sysinv.openstack.common.gettextutils import _
|
||||
import eventlet.semaphore
|
||||
|
||||
import re
|
||||
|
||||
@ -185,47 +184,6 @@ class NoExceptionTracebackHook(hooks.PecanHook):
|
||||
state.response.json = json_body
|
||||
|
||||
|
||||
class MutexTransactionHook(hooks.TransactionHook):
|
||||
"""Custom hook for SysInv transactions.
|
||||
Until transaction based database is enabled, this allows setting mutex
|
||||
on sysinv REST API update operations.
|
||||
"""
|
||||
|
||||
SYSINV_API_SEMAPHORE_TIMEOUT = 30
|
||||
|
||||
def __init__(self):
|
||||
super(MutexTransactionHook, self).__init__(
|
||||
start=self.lock,
|
||||
start_ro=self.start_ro,
|
||||
commit=self.unlock,
|
||||
rollback=self.unlock,
|
||||
clear=self.clear)
|
||||
|
||||
self._sysinv_semaphore = eventlet.semaphore.Semaphore(1)
|
||||
LOG.info("_sysinv_semaphore %s" % self._sysinv_semaphore)
|
||||
|
||||
def lock(self):
|
||||
if not self._sysinv_semaphore.acquire(
|
||||
timeout=self.SYSINV_API_SEMAPHORE_TIMEOUT):
|
||||
LOG.warn("WAIT Time initial expire SYSINV sema %s" %
|
||||
self.SYSINV_API_SEMAPHORE_TIMEOUT)
|
||||
if not self._sysinv_semaphore.acquire(
|
||||
timeout=self.SYSINV_API_SEMAPHORE_TIMEOUT):
|
||||
LOG.error("WAIT Time expired SYSINV sema %s" %
|
||||
self.SYSINV_API_SEMAPHORE_TIMEOUT)
|
||||
raise exc.HTTPConflict()
|
||||
|
||||
def start_ro(self):
|
||||
return
|
||||
|
||||
def unlock(self):
|
||||
self._sysinv_semaphore.release()
|
||||
LOG.debug("unlock SYSINV sema %s" % self._sysinv_semaphore)
|
||||
|
||||
def clear(self):
|
||||
return
|
||||
|
||||
|
||||
class AuditLogging(hooks.PecanHook):
|
||||
"""Performs audit logging of all sysinv ["POST", "PUT","PATCH","DELETE"] REST requests"""
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Pool(pools.Pool):
|
||||
self.reply_proxy = None
|
||||
|
||||
# TODO(comstud): Timeout connections not used in a while
|
||||
def create(self):
|
||||
def create(self): # pylint: disable=method-hidden
|
||||
LOG.debug(_('Pool creating new connection'))
|
||||
return self.connection_cls(self.conf)
|
||||
|
||||
|
@ -481,7 +481,7 @@ class Connection(object):
|
||||
"%(hostname)s:%(port)d") % params)
|
||||
try:
|
||||
self.connection.release()
|
||||
except self.connection_errors:
|
||||
except self.connection.connection_errors:
|
||||
pass
|
||||
# Setting this in case the next statement fails, though
|
||||
# it shouldn't be doing any network operations, yet.
|
||||
|
Loading…
Reference in New Issue
Block a user