[autotest] Extract _stage_artifacts_for_build()

BUG=None
TEST=None

Change-Id: Ic1d086c52729d375a9b1e449e06d35a8f8ce01f0
Reviewed-on: https://chromium-review.googlesource.com/514645
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/server/cros/dynamic_suite/dynamic_suite.py b/server/cros/dynamic_suite/dynamic_suite.py
index 477cdfe..4434935 100644
--- a/server/cros/dynamic_suite/dynamic_suite.py
+++ b/server/cros/dynamic_suite/dynamic_suite.py
@@ -472,7 +472,7 @@
     # control_files and test_suites packages so that we can get the control
     # files we should schedule.
     if not spec.run_prod_code:
-        _stage_artifacts(spec)
+        _stage_artifacts_for_build(spec.devserver, spec.test_source_build)
 
     timestamp = datetime.datetime.now().strftime(time_utils.TIME_FMT)
     utils.write_keyval(
@@ -525,14 +525,15 @@
                      'without waiting for test jobs to finish.')
 
 
-def _stage_artifacts(suite_spec):
+def _stage_artifacts_for_build(devserver, build):
     """Stage artifacts for a suite job.
 
-    @param suite_spec: a populated SuiteSpec object.
+    @param devserver: devserver to stage artifacts with.
+    @param build: image to stage artifacts for.
     """
     try:
-        suite_spec.devserver.stage_artifacts(
-                image=suite_spec.test_source_build,
+        devserver.stage_artifacts(
+                image=build,
                 artifacts=['control_files', 'test_suites'])
     except dev_server.DevServerException as e:
         # If we can't get the control files, there's nothing to run.