Ensure USER environment variable is always set within autoserv.
Many server side tests depend on it & it doesn't hurt to be a pedant
about environment vars.
Signed-off-by: Gregory Smith <gps@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4067 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/autoserv b/server/autoserv
index be31758..087fd4a 100755
--- a/server/autoserv
+++ b/server/autoserv
@@ -6,7 +6,7 @@
Run an control file through the server side engine
"""
-import sys, os, re, traceback, signal, time, logging
+import sys, os, re, traceback, signal, time, logging, getpass
import common
@@ -53,6 +53,10 @@
# Set signal handler
signal.signal(signal.SIGTERM, handle_sigterm)
+ # Server side tests that call shell scripts often depend on $USER being set
+ # but depending on how you launch your autotest scheduler it may not be set.
+ os.environ['USER'] = getpass.getuser()
+
if parser.options.machines:
machines = parser.options.machines.replace(',', ' ').strip().split()
else: