summaryrefslogtreecommitdiffstats
path: root/openstack/common/rootwrap/wrapper.py
diff options
context:
space:
mode:
authorThierry Carrez <thierry@openstack.org>2013-05-09 15:10:56 +0200
committerThierry Carrez <thierry@openstack.org>2013-05-09 15:10:56 +0200
commit562cc6844d3dc5cbd35ad404307224959900df30 (patch)
treedfae138829fbe1ad07695d855d2278b13e7de75f /openstack/common/rootwrap/wrapper.py
parente523c8c591806454e0e326bbdac57508787f8d24 (diff)
downloadoslo-562cc6844d3dc5cbd35ad404307224959900df30.tar.gz
oslo-562cc6844d3dc5cbd35ad404307224959900df30.tar.xz
oslo-562cc6844d3dc5cbd35ad404307224959900df30.zip
Stylistic improvements from quantum-rootwrap
As part of the convergence effort between oslo-rootwrap and quantum-rootwrap, import stylistic improvements introduced in quantum-rootwrap, like: - HACKING-compliant docstrings - More elegant return construct from match_filter in filters.py - Remove overridden use of filters in wrapper.py Change-Id: I49a97271b1c385feb25adf4f62add5c71962b5dd
Diffstat (limited to 'openstack/common/rootwrap/wrapper.py')
-rw-r--r--openstack/common/rootwrap/wrapper.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/openstack/common/rootwrap/wrapper.py b/openstack/common/rootwrap/wrapper.py
index e0ac9df..d488ddd 100644
--- a/openstack/common/rootwrap/wrapper.py
+++ b/openstack/common/rootwrap/wrapper.py
@@ -93,7 +93,7 @@ def setup_syslog(execname, facility, level):
def build_filter(class_name, *args):
- """Returns a filter object of class class_name"""
+ """Returns a filter object of class class_name."""
if not hasattr(filters, class_name):
logging.warning("Skipping unknown filter class (%s) specified "
"in filter definitions" % class_name)
@@ -103,7 +103,7 @@ def build_filter(class_name, *args):
def load_filters(filters_path):
- """Load filters from a list of directories"""
+ """Load filters from a list of directories."""
filterlist = []
for filterdir in filters_path:
if not os.path.isdir(filterdir):
@@ -121,7 +121,7 @@ def load_filters(filters_path):
return filterlist
-def match_filter(filters, userargs, exec_dirs=[]):
+def match_filter(filter_list, userargs, exec_dirs=[]):
"""
Checks user command and arguments through command filters and
returns the first matching filter.
@@ -131,7 +131,7 @@ def match_filter(filters, userargs, exec_dirs=[]):
"""
first_not_executable_filter = None
- for f in filters:
+ for f in filter_list:
if f.match(userargs):
# Try other filters if executable is absent
if not f.get_exec(exec_dirs=exec_dirs):