Skip to content

[Enhancement] Flag to disable variable parsing of custom userdata yaml file #42

@zanewgray

Description

@zanewgray

Issue: When using a custom userdata yaml file, the "ExpandString" portion of "New-HyperVCloudImageVM.ps1" causes errors when parsing of PowerShell variables is not required/desired.

Examples:

  1. Adding the following to the runcmd: section of a custom userdata file:
  # Install the Kubectl binary:
  - |
    curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

causes the script to fail with the following error:

Image

  1. Adding the following to the runcmd: section of the custom userdata file:
  # Install the Cilium CNI CLI binary:
  - |
    CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
    CLI_ARCH=amd64
    if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
    curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
    sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}

causes the script to fail with the following error:

Image

Removing these sections from the userdata yaml file allows the script to run without error, but results in the undesirable result of having to manually run the commands after the VM build completes.

Recommendation: Provide a flag or other option to disable variable parsing when using a custom userdata yaml file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions