[autotest] move gs_offloader to use the chromite version of gsutil

Infra team moved devserver to use the chromite gsutil.

Move gs_offloader to be consistent

BUG=chromium:722976
TEST=run unit tests.

Change-Id: I58a94c29bbefb75d49fc053b7c0db8315d5cf22e
Reviewed-on: https://chromium-review.googlesource.com/506604
Commit-Ready: Keith Haddow <haddowk@chromium.org>
Tested-by: Keith Haddow <haddowk@chromium.org>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/site_utils/gs_offloader.py b/site_utils/gs_offloader.py
index 581d43e..c4c3265 100755
--- a/site_utils/gs_offloader.py
+++ b/site_utils/gs_offloader.py
@@ -36,6 +36,7 @@
 from autotest_lib.site_utils import job_directories
 from autotest_lib.site_utils import pubsub_utils
 from autotest_lib.tko import models
+from chromite.lib import gs
 
 # Autotest requires the psutil module from site-packages, so it must be imported
 # after "import common".
@@ -141,6 +142,9 @@
 # the message data for new test result notification.
 NEW_TEST_RESULT_MESSAGE = 'NEW_TEST_RESULT'
 
+# Full path to the correct gsutil command to run.
+_GSUTIL_CMD = gs.GSContext.GetDefaultGSUtilBin()
+
 
 class TimeoutException(Exception):
     """Exception raised by the timeout_handler."""
@@ -172,7 +176,7 @@
 
     @return A command list to be executed by Popen.
     """
-    cmd = ['gsutil']
+    cmd = [_GSUTIL_CMD]
     if multiprocessing:
         cmd.append('-m')
     if USE_RSYNC_ENABLED:
@@ -663,7 +667,7 @@
         try:
             subprocess.check_call(test_cmd)
             subprocess.check_call(
-                    ['gsutil', 'rm',
+                    [_GSUTIL_CMD, 'rm',
                      os.path.join(gs_uri,
                                   os.path.basename(dummy_file.name))])
             break
diff --git a/site_utils/gs_offloader_unittest.py b/site_utils/gs_offloader_unittest.py
index 0c47598..5e67585 100755
--- a/site_utils/gs_offloader_unittest.py
+++ b/site_utils/gs_offloader_unittest.py
@@ -388,7 +388,7 @@
                 multi, job.queue_args[0],
                 os.path.join(test_bucket_uri, job.queue_args[1]))
 
-        self.assertEqual(command[0], 'gsutil')
+        self.assertEqual(command[0], gs_offloader._GSUTIL_CMD)
         if multi:
             self.assertEqual(command[1], '-m')
         self.assertEqual(command[-2], job.queue_args[0])