Skip to content

Broken cloud init if ENV contains double quote #452

@dbalabka

Description

@dbalabka

Describe the issue:

Scheduler will be shutdown by guest OS if any ENVs contain "

Minimal Complete Verifiable Example:

GCPCluster(
        env_vars={"ANY_VAR": '"'} 
    )

The cloud init will contains:

...
# Run container:
 - 'docker run ...  -e GCP_ANY_VAR=""" ...'
...

while it should escape " propely:

...
# Run container:
 - 'docker run ...  -e GCP_ANY_VAR="\"" ...'
...

To fix the problem we have to:

  1. Properly refactor the command rendering in cloud-init:
    - '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 }}'
  2. There should be proper error logging to show that cloud init does not pass

Environment:

  • Dask version: 2024.12.1
  • Python version: 3.11
  • Operating System: WSL
  • Install method (conda, pip, source): poetry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions