Replaced os.environ['HOME'] usage with os.path.expanduser() to not fail
when HOME is not defined.
Signed-off-by: Mihai Rusu <dizzy@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3140 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvmtest/kvmtest.py b/client/tests/kvmtest/kvmtest.py
index e2b77db..929290f 100644
--- a/client/tests/kvmtest/kvmtest.py
+++ b/client/tests/kvmtest/kvmtest.py
@@ -26,7 +26,7 @@
# spawn vncserver if needed
if not os.environ.has_key('DISPLAY'):
print("No DISPLAY set in environment, spawning vncserver...")
- display = self.__create_vncserver(os.environ['HOME'] + "/.vnc")
+ display = self.__create_vncserver(os.path.expanduser("~/.vnc"))
print("Setting DISPLAY=%s"%(display))
os.environ['DISPLAY'] = display
diff --git a/server/base_utils.py b/server/base_utils.py
index 274a74e..e38fc45 100644
--- a/server/base_utils.py
+++ b/server/base_utils.py
@@ -315,7 +315,7 @@
ssh-keygen and return it.
"""
- ssh_conf_path = os.path.join(os.environ['HOME'], '.ssh')
+ ssh_conf_path = os.path.expanduser('~/.ssh')
dsa_public_key_path = os.path.join(ssh_conf_path, 'id_dsa.pub')
dsa_private_key_path = os.path.join(ssh_conf_path, 'id_dsa')