summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacky06 <zhang.min@99cloud.net>2019-03-06 22:39:33 +0800
committerjacky06 <zhang.min@99cloud.net>2019-03-06 22:39:45 +0800
commita84402e79f55d97c0c3140ae3e5821bfca65de5e (patch)
tree539a2698cf78ec328945b2f9c1c5d7f528fa3378
parent0b6824d17818e91018409fea4ff06c54b7f9f647 (diff)
downloadoslo-rootwrap-a84402e79f55d97c0c3140ae3e5821bfca65de5e.tar.gz
Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8 Change-Id: Ib78453ccb8fe3fa16d35bb49dd443cd6628ff932
-rw-r--r--oslo_rootwrap/filters.py8
-rw-r--r--oslo_rootwrap/wrapper.py14
-rw-r--r--test-requirements.txt2
-rw-r--r--tox.ini3
4 files changed, 15 insertions, 12 deletions
diff --git a/oslo_rootwrap/filters.py b/oslo_rootwrap/filters.py
index c4c7abc..ba017af 100644
--- a/oslo_rootwrap/filters.py
+++ b/oslo_rootwrap/filters.py
@@ -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:]
diff --git a/oslo_rootwrap/wrapper.py b/oslo_rootwrap/wrapper.py
index 0e115f8..c454fe2 100644
--- a/oslo_rootwrap/wrapper.py
+++ b/oslo_rootwrap/wrapper.py
@@ -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)]
diff --git a/test-requirements.txt b/test-requirements.txt
index ed60fb1..b2c4e8f 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -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
diff --git a/tox.ini b/tox.ini
index 0ed64d5..894d265 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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]