summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/rootwrap/filters.py3
-rw-r--r--openstack/common/rootwrap/wrapper.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/openstack/common/rootwrap/filters.py b/openstack/common/rootwrap/filters.py
index dfec412..b40fdfd 100644
--- a/openstack/common/rootwrap/filters.py
+++ b/openstack/common/rootwrap/filters.py
@@ -217,7 +217,8 @@ class KillFilter(CommandFilter):
return (os.path.isabs(command) and
kill_command == os.path.basename(command) and
- os.path.dirname(command) in os.environ['PATH'].split(':'))
+ os.path.dirname(command) in os.environ.get('PATH', ''
+ ).split(':'))
class ReadFileFilter(CommandFilter):
diff --git a/openstack/common/rootwrap/wrapper.py b/openstack/common/rootwrap/wrapper.py
index df1a9f4..6bd829e 100644
--- a/openstack/common/rootwrap/wrapper.py
+++ b/openstack/common/rootwrap/wrapper.py
@@ -46,8 +46,10 @@ class RootwrapConfig(object):
if config.has_option("DEFAULT", "exec_dirs"):
self.exec_dirs = config.get("DEFAULT", "exec_dirs").split(",")
else:
+ self.exec_dirs = []
# Use system PATH if exec_dirs is not specified
- self.exec_dirs = os.environ["PATH"].split(':')
+ if "PATH" in os.environ:
+ self.exec_dirs = os.environ['PATH'].split(':')
# syslog_log_facility
if config.has_option("DEFAULT", "syslog_log_facility"):