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

--fileoutput is not printing to file #180

Closed
caruccio opened this issue Dec 14, 2023 · 3 comments
Closed

--fileoutput is not printing to file #180

caruccio opened this issue Dec 14, 2023 · 3 comments

Comments

@caruccio
Copy link

Describe the bug

Using --fileoutput result.json creates an empty file.

To Reproduce

kind create cluster
helm install monitoring prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
python krr.py simple -f json --fileoutput result.json

The whole output is being printed to stdout. The file result.json is empty.

$ ls -l  result.json 
-rw-r--r-- 1 mateus mateus 0 dez 14 15:57 result.json

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Are you interested in contributing a fix for this?
Yes/no. If yes, we will provide guidance what parts of the code to modify and help you.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@caruccio
Copy link
Author

A simple workaround to have json saved into a file is to print from ^{ to ^}:

$ python krr.py simple -f json | sed -ne '/^{/,/^}/p' | tr -d '\n'| jq -r > result.json 

tr -d '\n' is required in order to transform multiline-strings into single line.

@aantn
Copy link
Contributor

aantn commented Mar 2, 2024

Should be fixed in #218

Can you confirm please?

@caruccio
Copy link
Author

caruccio commented Mar 6, 2024

Confirmed it's now working. Thanks a lot.

@caruccio caruccio closed this as completed Mar 6, 2024
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

No branches or pull requests

2 participants