siderolabs / talos

Talos Linux is a modern Linux distribution built for Kubernetes.
https://www.talos.dev
Mozilla Public License 2.0
6.96k stars 565 forks source link

CLI talosctl apply-config doesn't accept inline config patches - bare " in non-quoted-field #9493

Closed SystemZ closed 1 month ago

SystemZ commented 1 month ago

Bug Report

Description

Hi, I'm new user and I'm very satisfied with Talos! I want to thanks all contributors and maintainers for great project :)

I tried simple example from docs which sets hostname https://www.talos.dev/v1.8/talos-guides/configuration/patching/#configuration-patching-with-talosctl-cli

This would help me eliminate need to edit patch file per each node deployment, it's cumbersome and I wanted to have one liner for that. I encountered problems with using inline patches.

talosctl apply-config --insecure --file talos-a/controlplane.yaml --nodes 192.168.2.73 -p '[{"op": "add", "path": "/machine/network/hostname", "value": "talos-a-cp-3"}]'

I tried to replace " with ' with various combinations, using \ and double and tripe " to escape but no dice, constantly it won't accept, with various errors.

Logs

invalid argument "[{\"op\": \"add\", \"path\": \"/machine/network/hostname\", \"value\": \"talos-a-cp-3\"}]" for "-p, --config-patch" flag: parse error on line 1, column 3: bare " in non-quoted-field

Environment

I use zsh on macOS 15.0.1

zsh --version
zsh 5.9 (arm64-apple-darwin24.0)

talosctl version
Client:
        Tag:         v1.8.0
        SHA:         5cc935f7
        Built:
        Go version:  go1.22.7
        OS/Arch:     darwin/arm64
DmitriyMV commented 1 month ago

Greetings! Yeah, thats a bug thats related to how pflag/cobra library works. It was fixed for talos create and talos gen but apparently not for talos apply-config. Fix incoming.