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

Using "-" as filename to read config from stdin does not work #2917

Closed
4 tasks done
kke opened this issue Mar 24, 2023 · 5 comments · Fixed by #4834
Closed
4 tasks done

Using "-" as filename to read config from stdin does not work #2917

kke opened this issue Mar 24, 2023 · 5 comments · Fixed by #4834
Labels

Comments

@kke
Copy link
Contributor

kke commented Mar 24, 2023

Before creating an issue, make sure you've checked the following:

  • You are running the latest released version of k0s
  • Make sure you've searched for existing issues, both open and closed
  • Make sure you've searched for PRs too, a fix might've been merged already
  • You're looking at docs for the released version, "main" branch docs are usually ahead of released versions.

Platform

Any

Version

All since at least #1409

Sysinfo

No response

What happened?

Reading the config from stdin is broken. The docs for the config flag claim - can be used to read the config from stdin.

Steps to reproduce

$ k0s config validate --help
...
Flags:
  -c, --config string          config file, use '-' to read the config from stdin (default "/etc/k0s/k0s.yaml")
...
$ echo hello | k0s config validate --config -
Cannot access config file (-)" error="open -: no such file or directory

Expected behavior

Either it should work or it shouldn't claim reading from stdin is supported.

Actual behavior

It tries to open a file called -.

Screenshots and logs

No response

Additional context

The config.GetCmdOpts() should maybe return (CLIOptions, error) instead of just CLIOptions. It now uses log.Fatalf to bail out, which is a bit problematic for command tests.

Slightly related to #2791

@kke kke added bug Something isn't working area/configuration area/cli labels Mar 24, 2023
kke added a commit that referenced this issue Mar 27, 2023
Fixes #2917

Reading a file to check that it is readable before
actually reading it is not best practice. Just let
it fail when reading it.

Signed-off-by: Kimmo Lehto <[email protected]>
@kke kke mentioned this issue Mar 27, 2023
16 tasks
kke added a commit that referenced this issue Mar 27, 2023
Fixes #2917

Reading a file to check that it is readable before
actually reading it is not best practice. Just let
it fail when reading it.

Signed-off-by: Kimmo Lehto <[email protected]>
kke added a commit that referenced this issue Mar 27, 2023
Fixes #2917

Reading a file to check that it is readable before
actually reading it is not best practice. Just let
it fail when reading it.

Signed-off-by: Kimmo Lehto <[email protected]>
@github-actions
Copy link
Contributor

The issue is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added the Stale label Apr 23, 2023
@jnummelin jnummelin removed the Stale label Apr 24, 2023
@github-actions
Copy link
Contributor

The issue is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added the Stale label May 24, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2023
@kke
Copy link
Contributor Author

kke commented Jun 2, 2023

It's still broken, #3072 fixes it for at least k0s config validate.

@kke kke reopened this Jun 2, 2023
@github-actions github-actions bot removed the Stale label Jun 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2023

The issue is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added the Stale label Jul 2, 2023
@twz123 twz123 removed the Stale label Jul 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

The issue is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added the Stale label Aug 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2023
@twz123 twz123 reopened this Aug 2, 2024
@twz123 twz123 removed the Stale label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants