Bug 1294234 - Assign command at end of function; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Tue, 09 Aug 2016 13:20:05 -0700
changeset 400208 52605d7091c73fc47da753bbb298b242f7a3a2ae
parent 400207 418f11ada7aaf16f3a4c3522f014b42690d44295
child 400209 264efc9b30e62927dece848b9b1eab7542cf2cba
push id26089
push userbmo:gps@mozilla.com
push dateFri, 12 Aug 2016 18:27:50 +0000
reviewersdustin
bugs1294234
milestone51.0a1
Bug 1294234 - Assign command at end of function; r?dustin Previously, the code performed a "hidden" assignment to worker['command'] when creating the "command" variable. This tripped me up when reading the code because relying on variable references isn't exactly obvious. We now defer the assignment to worker['command'] until the end, making the code a little easier to understand. MozReview-Commit-ID: 23qH4Z3RKY4
taskcluster/taskgraph/transforms/tests/make_task_description.py
--- a/taskcluster/taskgraph/transforms/tests/make_task_description.py
+++ b/taskcluster/taskgraph/transforms/tests/make_task_description.py
@@ -188,17 +188,17 @@ def docker_worker_setup(config, test, ta
         })
         taskdesc['scopes'].extend([
             'docker-worker:relengapi-proxy:tooltool.download.internal',
             'docker-worker:relengapi-proxy:tooltool.download.public',
         ])
 
     # assemble the command line
 
-    command = worker['command'] = ["bash", "/home/worker/bin/test.sh"]
+    command = ["bash", "/home/worker/bin/test.sh"]
     if mozharness.get('no-read-buildbot-config'):
         command.append("--no-read-buildbot-config")
     command.extend([
         {"task-reference": "--installer-url=" + installer_url},
         {"task-reference": "--test-packages-url=" + test_packages_url},
     ])
     command.extend(mozharness.get('extra-options', []))
 
@@ -213,8 +213,10 @@ def docker_worker_setup(config, test, ta
             for i, c in enumerate(command):
                 if isinstance(c, basestring) and c.startswith('--test-suite'):
                     command[i] += suffix
 
     if 'download-symbols' in mozharness:
         download_symbols = mozharness['download-symbols']
         download_symbols = {True: 'true', False: 'false'}.get(download_symbols, download_symbols)
         command.append('--download-symbols=' + download_symbols)
+
+    worker['command'] = command