diff options
author | Stephen Ma <stephen.ma@hpe.com> | 2017-02-22 11:09:04 -0800 |
---|---|---|
committer | Stephen Ma <stephen.ma@hpe.com> | 2017-02-28 04:34:00 -0800 |
commit | 0694fbc7a965ca3bcadeaadd3897581f07c6c5e9 (patch) | |
tree | c2126bb30fe2e87f0846c9af42faa37faa8181a9 /oslo_rootwrap/wrapper.py | |
parent | 1335a543be0e8c15fe8a8f06e3c29fe2f1e14a45 (diff) | |
download | oslo-rootwrap-0694fbc7a965ca3bcadeaadd3897581f07c6c5e9.tar.gz |
Don't open subdirectories rootwrap filter directories
A rootwrap filter directory may contain subdirectories. The rootwrap
daemon will crash when it tries to load filters from subdirectories.
So subdirectories should be skipped.
Change-Id: I4f618734300bf5eb81282fbf8fc213f995a4fe59
Diffstat (limited to 'oslo_rootwrap/wrapper.py')
-rw-r--r-- | oslo_rootwrap/wrapper.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/oslo_rootwrap/wrapper.py b/oslo_rootwrap/wrapper.py index 998beae..f5499fb 100644 --- a/oslo_rootwrap/wrapper.py +++ b/oslo_rootwrap/wrapper.py @@ -117,9 +117,12 @@ def load_filters(filters_path): continue for filterfile in filter(lambda f: not f.startswith('.'), os.listdir(filterdir)): + filterfilepath = os.path.join(filterdir, filterfile) + if not os.path.isfile(filterfilepath): + continue kwargs = {"strict": False} if six.PY3 else {} filterconfig = moves.configparser.RawConfigParser(**kwargs) - filterconfig.read(os.path.join(filterdir, filterfile)) + filterconfig.read(filterfilepath) for (name, value) in filterconfig.items("Filters"): filterdefinition = [s.strip() for s in value.split(',')] newfilter = build_filter(*filterdefinition) |