From 5aa7d4ccf984ac296f58fa355bdce17d175dcc7d Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 23 Jan 2014 16:48:12 -0500 Subject: fix util.which if PATH is not in environment This fixes a test case that failed because PATH was unset in the os.environ. --- cloudinit/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cloudinit/util.py') 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): -- cgit v1.2.3