From 233baa20f5f7c83c20c410da10861ea0fa6a0307 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 18 Jun 2013 19:37:34 +0200 Subject: Handle empty PATH environment variable In locked down environments, PATH might be unavailable when running rootwrap. Change-Id: Ia55514a7d69ab26c2bcf5d1839da1d36aaf46ebc --- openstack/common/rootwrap/wrapper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'openstack/common/rootwrap/wrapper.py') 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"): -- cgit