Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SystemZ opened this issue Oct 12, 2024 · 1 comment · Fixed by #9497
Closed
Assignees

Comments

@SystemZ
Copy link

SystemZ commented Oct 12, 2024

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
Copy link
Member

DmitriyMV commented Oct 12, 2024

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.

DmitriyMV added a commit to DmitriyMV/talos that referenced this issue Oct 12, 2024
Modules pflag and cobra use csv.Reader for `StringSliceVar` method. This doesn't work well with JSON, and we do not need this at all.
Drop it.

Fixes siderolabs#9493

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
@DmitriyMV DmitriyMV self-assigned this Oct 13, 2024
smira pushed a commit to smira/talos that referenced this issue Oct 25, 2024
Modules pflag and cobra use csv.Reader for `StringSliceVar` method. This doesn't work well with JSON, and we do not need this at all.
Drop it.

Fixes siderolabs#9493

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
(cherry picked from commit 4d90202)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants