saltstack / pepper

A library and stand-alone CLI tools to access a salt-api instance
Other
246 stars 124 forks source link

Unable to use --state-output=mixed --state-verbose=false with pepper #217

Open anthosz opened 3 years ago

anthosz commented 3 years ago

Hi,

I have a custom state with a big number of minion in targets.

My goal is that I try to extract only the states changed to avoid a big output (so to summarize equivalent to --state-output=mixed --state-verbose=false with salt).

After checks, I found: https://github.com/saltstack/pepper/issues/3 and especially https://gist.github.com/bbinet/d87bf2571652e4dec68df6b280b2af9d done by @bbinet but nothing works:

## Tried with several client also like local_async, sync, etc.. (but outputer need to be json)
$ pepper --fail-any-none --non-interactive -o json "*" state.sls custom | pepper_format
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 137 column 1 (char 6871)
## Extracting only one entry (issue related to the fact it's own json by minion
$ pepper --fail-any-none --non-interactive -o json "minion1" state.sls custom | pepper_format
    ret = json.load(sys.stdin)['return'][0]
KeyError: 'return'

Do you have an idea how to fix it or if it's planned to be implemented in pepper directly?

Best regards,

ahktenzero commented 3 years ago

I opened a PR to add support for those output options a while back: #209.

anthosz commented 3 years ago

@ahktenzero thx, I will test it and patch it directly with the diff of your PR! (this project seems not very active..)