diff options
author | Joshua Powers <josh.powers@canonical.com> | 2017-09-11 10:29:19 -0700 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-09-13 21:16:43 -0400 |
commit | 1ac4bc2a4758d330bb94cd1b2391121cf461ff6a (patch) | |
tree | 40f2e93a89a7d3b830fecf5b1d6c2208ffaf25d5 /tests/cloud_tests/bddeb.py | |
parent | ed8f1b159174715403cb1ffa200ff6d080770152 (diff) | |
download | vyos-cloud-init-1ac4bc2a4758d330bb94cd1b2391121cf461ff6a.tar.gz vyos-cloud-init-1ac4bc2a4758d330bb94cd1b2391121cf461ff6a.zip |
tests: execute: support command as string
If a string is passed to execute, then invoke 'bash', '-c',
'string'. That allows the less verbose execution of simple
commands:
image.execute("ls /run")
compared to the more explicit but longer winded:
image.execute(["ls", "/run"])
If 'env' was ever modified in execute or a method that it called,
then the next invocation's default value would be changed. Instead
use None and then set to a new empty dict in the method.
Diffstat (limited to 'tests/cloud_tests/bddeb.py')
-rw-r--r-- | tests/cloud_tests/bddeb.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/cloud_tests/bddeb.py b/tests/cloud_tests/bddeb.py index fe805356..fba8a0c7 100644 --- a/tests/cloud_tests/bddeb.py +++ b/tests/cloud_tests/bddeb.py @@ -28,8 +28,7 @@ def build_deb(args, instance): # update remote system package list and install build deps LOG.debug('installing pre-reqs') pkgs = ' '.join(pre_reqs) - cmd = 'apt-get update && apt-get install --yes {}'.format(pkgs) - instance.execute(['/bin/sh', '-c', cmd]) + instance.execute('apt-get update && apt-get install --yes {}'.format(pkgs)) # local tmpfile that must be deleted local_tarball = tempfile.NamedTemporaryFile().name |