-
Notifications
You must be signed in to change notification settings - Fork 44
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
nsc generate nkey
outputs good response to stderr rather than stdout
#580
Comments
nsc generate nkey
outputs good response to stderr rather than stdout
Verified, the generated key should be sent to stdout. Now wondering if |
Maybe, nsc generate nkey -a --store --json
{
"type": "account",
"key": "ACWGQFI6UZMVZREABW4GZVXQA6XTJBGGKZJLJHBPEDQLWMOJQLM3IVRB",
"path": "/root/.local/share/nats/nsc/keys/keys/A/CW/ACWGQFI6UZMVZREABW4GZVXQA6XTJBGGKZJLJHBPEDQLWMOJQLM3IVRB.nk"
} It would be really helpful, for automation, for there to be an option to output json on every nsc command. But, that is not the subject of this ticket. All nsc commands, that I looked at today, output good responses to stderr, rather than stdout, which is unexpected. All of the following commands output to stderr with nothing at all going to stdout. In my script, all of them complete successfully and return rc 0. nsc edit operator --sk OAKKUPVDAEOXMRWTG7MKOAFJNX2I2LHJQMLCXKHDLNQB4OZHGMRX7XWU
nsc describe operator --raw --output-file $HOME/OT.jwt --all-dirs $HOME/O
nsc add operator -u $HOME/OT.jwt --force --all-dirs $HOME/V
nsc add account -n T --all-dirs $HOME/O
nsc edit account -n T --sk ABZRCHNMDORQW5H4WU6HQLQSJZQVVG72L77DRT64RB4V3JWNESS7LCIK
nsc describe account -n T --raw --output-file $HOME/AT.jwt --all-dirs $HOME/O
nsc import account --file $HOME/AT.jwt --overwrite --all-dirs $HOME/V
nsc add user --account T --name easy --all-dirs $HOME/V --private-key ABZRCHNMDORQW5H4WU6HQLQSJZQVVG72L77DRT64RB4V3JWNESS7LCIK
nsc generate creds -a T -n easy -o $HOME/Ueasy.creds --all-dirs $HOME/V I would have expected that all of these successful commands would have written all of their output to stdout instead. In general, modern commands that are targeted towards automation, such as kubectl, write almost everything to stdout, to make automation simpler. |
All the above commands (with the exception of nsc generate nkey) return a report - the report was always directed to stderr (cobra is doing this). I have changed it to output to stdout - but it is possible that the report will have some error line Do note that for the describe commands do support |
The main issue here is that the change of the PR would indeed break havoc on current scripts - so this may be a no-go until we have a nondisruptive way of changing this as an opt-in/out option or a major version bump for nsc. |
…ented editing due to JetStream default values in the flag - added a flag that sets the values for the jetstream setting (--js-disable) which sets the values to 0 Fixes #580
nsc generate nkey
outputs a good response to stderr, rather than stdout, which is unexpected.In particular, I would expect the following ansible to work. But, to make it work i had to change stdout to stderr.
The text was updated successfully, but these errors were encountered: