Update hacking version

Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ib78453ccb8fe3fa16d35bb49dd443cd6628ff932
This commit is contained in:
jacky06 2019-03-06 22:39:33 +08:00
parent 0b6824d178
commit a84402e79f
4 changed files with 15 additions and 12 deletions

View File

@ -325,8 +325,8 @@ class EnvFilter(CommandFilter):
user_command = userargs[len(user_envs):len(user_envs) + 1]
# match first non-env argument with CommandFilter
return (super(EnvFilter, self).match(user_command)
and len(filter_envs) and user_envs == filter_envs)
return (super(EnvFilter, self).match(user_command) and
len(filter_envs) and user_envs == filter_envs)
def exec_args(self, userargs):
args = userargs[:]
@ -377,8 +377,8 @@ class IpNetnsExecFilter(ChainingFilter):
if self.run_as != "root" or len(userargs) < 4:
return False
return (userargs[0] == 'ip' and userargs[1] in NETNS_VARS
and userargs[2] in EXEC_VARS)
return (userargs[0] == 'ip' and userargs[1] in NETNS_VARS and
userargs[2] in EXEC_VARS)
def exec_args(self, userargs):
args = userargs[4:]

View File

@ -19,15 +19,15 @@ import os
import signal
import sys
if sys.platform != 'win32':
import pwd
import six
from six import moves
from oslo_rootwrap import filters
from oslo_rootwrap import subprocess
if sys.platform != 'win32':
import pwd
class NoFilterMatched(Exception):
"""This exception is raised when no filter matched."""
@ -73,8 +73,8 @@ class RootwrapConfig(object):
if config.has_option("DEFAULT", "syslog_log_level"):
v = config.get("DEFAULT", "syslog_log_level")
level = v.upper()
if (hasattr(logging, '_nameToLevel')
and level in logging._nameToLevel):
if (hasattr(logging, '_nameToLevel') and
level in logging._nameToLevel):
# Workaround a regression of Python 3.4.0 bug fixed in 3.4.2:
# http://bugs.python.org/issue22386
self.syslog_log_level = logging._nameToLevel[level]
@ -177,8 +177,8 @@ def match_filter(filter_list, userargs, exec_dirs=None):
# This command calls exec verify that remaining args
# matches another filter.
def non_chain_filter(fltr):
return (fltr.run_as == f.run_as
and not isinstance(fltr, filters.ChainingFilter))
return (fltr.run_as == f.run_as and
not isinstance(fltr, filters.ChainingFilter))
leaf_filters = [fltr for fltr in filter_list
if non_chain_filter(fltr)]

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=1.1.0,<1.2.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
testtools>=2.2.0 # MIT

View File

@ -49,7 +49,10 @@ deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
[flake8]
# E731 skipped as assign a lambda expression
show-source = True
ignore = E731
exclude = .tox,dist,doc,*.egg,build
[testenv:benchmark]