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
--- 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