saltstack / pepper

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

Pepper no longer respecting --out flag #228

Open Zylatis opened 1 year ago

Zylatis commented 1 year ago

Hi,

I have been using this without problem for a while but suddenly now all calls like pepper chase grains.item hub_info --out=json

return this

{
    "return": [
        {
            "chase": {
                "jid": "11111",
                "out": "nested",
                "ret": {
                    "data": {
                       <redacted>
                    }
                },
                "retcode": 0
            }
        }
    ]
}

which is borking my post processing a bit. I suspect maybe some weird package upgrade? I am on ubuntu and pepper 0.7.6 (i have tried an uninstall and reinstall etc)

barneysowood commented 1 year ago

Hi,

Thanks for the problem report. The --out option relies on an installed copy of salt to provide the outputters. Can you confirm what version of salt you have installed? Could you please include the output from salt --versions-report?

Thanks,

Barney

ggiesen commented 1 year ago

Also encountering this issue. Might this be due to OneDir?

ggiesen commented 1 year ago

FWIW I used a virtualenv to work around this (and installed a separate copy of Salt in it), whatever mechanism pip uses to generate an executable doesn't appear to work in relenv. Example state file:

pkg_python3-virtualenv:
  pkg.installed:
    - name: python3-virtualenv

virtualenv_/opt/pepper:
  virtualenv.managed:
    - name: /opt/pepper
    - user: root
    - pip_upgrade: True
    - pip_pkgs:
        - salt-pepper
        - salt
    - require:
        - pkg_python3-virtualenv

file_symlink_/usr/local/bin/pepper:
  file.symlink:
    - name: /usr/local/bin/pepper
    - target: /opt/pepper/bin/pepper
ggiesen commented 1 year ago

According to @s0undt3ch, salt-pip should install the pepper script in /opt/saltstack/salt/extras-3.10/bin (it is not), so I've filed a bug in the salt repo: https://github.com/saltstack/salt/issues/64662

Sxderp commented 1 year ago

I believe this issue has to do with OneDir. The --output flag is only used to reach into Salt's outputters / renderers. It's likely masked since most installs of Pepper already have Salt installed. As OneDir migrations occur and the Salt modules are no longer available globally the issue will come up more often.

It's a bit annoying that the current solutions are:

  1. Install Pepper in the Salt directory with salt-pip (Ew).
  2. Install the entirety of Salt back into a global (or virtualenv) location /just/ for the outputters (Ew).