summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-01-23 16:48:12 -0500
committerScott Moser <smoser@ubuntu.com>2014-01-23 16:48:12 -0500
commit5aa7d4ccf984ac296f58fa355bdce17d175dcc7d (patch)
tree7097c46c0c1db8c20954fcbf5a3dd46df0393ed2
parentb7eae0adee173208f0b98b6ad14d59771145215c (diff)
downloadvyos-cloud-init-5aa7d4ccf984ac296f58fa355bdce17d175dcc7d.tar.gz
vyos-cloud-init-5aa7d4ccf984ac296f58fa355bdce17d175dcc7d.zip
fix util.which if PATH is not in environment
This fixes a test case that failed because PATH was unset in the os.environ.
-rw-r--r--cloudinit/util.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index ce8dacbe..77f9ab36 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1850,7 +1850,7 @@ def which(program):
if is_exe(program):
return program
else:
- for path in os.environ["PATH"].split(os.pathsep):
+ for path in os.environ.get("PATH", "").split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):