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

Commands print non-json warning when output set to json #1015

Open
MichaelHindley opened this issue Jun 30, 2022 · 3 comments · May be fixed by #1017
Open

Commands print non-json warning when output set to json #1015

MichaelHindley opened this issue Jun 30, 2022 · 3 comments · May be fixed by #1017
Assignees
Labels
area/cli kind/bug Something isn't working P1 triaged/resolved The issue has been triaged
Milestone

Comments

@MichaelHindley
Copy link

When using the list command(and others it seems) always print the warning.

This makes it very hard to programatically do things based on for instance json output, since the json output is not valid json due to the warning that is always printed, introducing parsing logic for the warning before working with the json output.

➜  k8s git:(main) ✗ dapr list -k --namespace default -o json
⚠  In future releases, this command will only query the "default" namespace by default. Please use the --namespace flag for a specific namespace, or the --all-namespaces (-A) flag for all namespaces.
{
  "namespace": "default",
  "appId": "bakery",
  "appPort": "8080",
  "age": "16h",
  "created": "2022-06-29 18:01.58"
}

SyntaxError: Unexpected token ⚠ in JSON at position 0

Suggestion: If namespace is provided to the command, or json output requested, disable the warning from printing.
Or add a flag to disable the warning (--no-warning) or similar.

print.WarningStatusEvent(os.Stdout, "In future releases, this command will only query the \"default\" namespace by default. Please use the --namespace flag for a specific namespace, or the --all-namespaces (-A) flag for all namespaces.")

@pravinpushkar
Copy link
Contributor

I think, --no-warning can be a good addition here. @mukundansundar @yaron2

@MichaelHindley MichaelHindley linked a pull request Jul 4, 2022 that will close this issue
3 tasks
@mukundansundar
Copy link
Collaborator

@MichaelHindley I think warnings should be printed in STDERR ... Thereby if only STDOUT is read, only the output will be there ....
Also for flag, this is too specific to this warning ... I am thinking it should probably be some form of a well known flag name like --quiet or --silent and that it should apply to all commands globally in dapr CLI ...
@yaron2 Thoughts?

@mukundansundar mukundansundar added this to the v1.9 milestone Jul 5, 2022
@mukundansundar mukundansundar added kind/bug Something isn't working area/cli P1 triaged/resolved The issue has been triaged labels Jul 5, 2022
@mukundansundar mukundansundar modified the milestones: v1.9, v1.10 Sep 27, 2022
@mukundansundar mukundansundar modified the milestones: v1.10, v1.11 Jan 27, 2023
@mukundansundar mukundansundar modified the milestones: v1.11, v1.12 Apr 19, 2023
@mukundansundar mukundansundar modified the milestones: v1.12, v1.13 Sep 15, 2023
@mukundansundar mukundansundar modified the milestones: v1.13, v1.14 Feb 8, 2024
@FlorentATo
Copy link

Gentle bump :)

@cicoyle cicoyle modified the milestones: v1.14, v1.15 Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli kind/bug Something isn't working P1 triaged/resolved The issue has been triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants