ACCUMULO-2378 Replace LOGNAME usage in TestUtils.py with getpass

When running functional tests under MapReduce, the LOGNAME environment variable 
is
not available. This change switches TestUtils.py to use getpass.getuser(), which
looks for a variety of environment variables to locate the current user, and 
which
works more reliably.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/38983172
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/38983172
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/38983172

Branch: refs/heads/1.4.5-SNAPSHOT
Commit: 389831727a8f6ab2fda98f279a5cba442081ca69
Parents: c5a787b
Author: Bill Havanki <bhava...@cloudera.com>
Authored: Wed Feb 19 08:54:02 2014 -0500
Committer: Bill Havanki <bhava...@cloudera.com>
Committed: Wed Feb 19 08:54:02 2014 -0500

----------------------------------------------------------------------
 test/system/auto/TestUtils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/38983172/test/system/auto/TestUtils.py
----------------------------------------------------------------------
diff --git a/test/system/auto/TestUtils.py b/test/system/auto/TestUtils.py
index c7d1d83..f36b017 100644
--- a/test/system/auto/TestUtils.py
+++ b/test/system/auto/TestUtils.py
@@ -27,6 +27,7 @@ import random
 import re
 import shutil
 import sleep
+import getpass
 
 # mapreduce sets SIGHUP to ignore, which we use to stop child processes
 # so set it back to the default
@@ -42,7 +43,7 @@ FUZZ=os.getpid() % 997
 ACCUMULO_HOME = os.path.dirname(__file__)
 ACCUMULO_HOME = os.path.join(ACCUMULO_HOME, *(os.path.pardir,)*3)
 ACCUMULO_HOME = os.path.realpath(ACCUMULO_HOME)
-ACCUMULO_DIR = "/user/" + os.getenv('LOGNAME') + "/accumulo-" + ID
+ACCUMULO_DIR = "/user/" + getpass.getuser() + "/accumulo-" + ID
 if os.getenv('ACCUMULO_CONF_DIR'):
    ACCUMULO_CONF_DIR = os.getenv('ACCUMULO_CONF_DIR')
 else:

Reply via email to