nsc icon indicating copy to clipboard operation
nsc copied to clipboard

`nsc generate nkey` outputs good response to stderr rather than stdout

Open kimjarvis opened this issue 1 year ago • 4 comments

nsc generate nkey outputs a good response to stderr, rather than stdout, which is unexpected.

root@instance:/# nsc generate nkey -a --store 2> e
root@instance:/# nsc generate nkey -a --store
AALS5NG2EJCJGCBTCRRH4PJO2R2UFHVAAIPLZEI5OPHHGW5T67DFNJRY
account key stored /root/.local/share/nats/nsc/keys/keys/A/AL/AALS5NG2EJCJGCBTCRRH4PJO2R2UFHVAAIPLZEI5OPHHGW5T67DFNJRY.nk

In particular, I would expect the following ansible to work. But, to make it work i had to change stdout to stderr.

    - name: Generate account signing key
      ansible.builtin.shell: >-
        nsc generate nkey -a --store
        {{ client_config }}
      register: result

    - name: Get the client account signing key 
      ansible.builtin.set_fact: client_account_signing_key="{{result.stdout_lines[0]}}"

kimjarvis avatar Apr 09 '23 16:04 kimjarvis