Skip to content

Commit

Permalink
Fix for #257. (#258)
Browse files Browse the repository at this point in the history
When an env_vars variable is passed to the docker run command and
it contains one or more space characters, we need to wrapp the
value in double quotes.

Co-authored-by: mo <mrghanavati>
  • Loading branch information
heiqs authored Feb 23, 2021
1 parent 093af2f commit 52dbfeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dask_cloudprovider/aws/tests/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async def test_get_cloud_init():
docker_args="--privileged",
)
assert "systemctl start docker" in cloud_init
assert " -e EXTRA_PIP_PACKAGES=s3fs " in cloud_init
assert ' -e EXTRA_PIP_PACKAGES="s3fs" ' in cloud_init
assert " --privileged " in cloud_init


Expand Down
2 changes: 1 addition & 1 deletion dask_cloudprovider/generic/cloud-init.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ runcmd:
{% endif %}

# Run container
- 'docker run --net=host {%+ if gpu_instance %}--gpus=all{% endif %} {% for key in env_vars %} -e {{key}}={{env_vars[key]}} {% endfor %}{%+ if docker_args %}{{docker_args}}{% endif %} {{image}} {{ command }}'
- 'docker run --net=host {%+ if gpu_instance %}--gpus=all{% endif %} {% for key in env_vars %} -e {{key}}="{{env_vars[key]}}" {% endfor %}{%+ if docker_args %}{{docker_args}}{% endif %} {{image}} {{ command }}'

{% if auto_shutdown %}
# Shutdown when command is done
Expand Down

0 comments on commit 52dbfeb

Please sign in to comment.