pepper icon indicating copy to clipboard operation
pepper copied to clipboard

Pepper no longer respecting --out flag

Open Zylatis opened this issue 2 years ago • 5 comments

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)

Zylatis avatar May 01 '23 02:05 Zylatis

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

barneysowood avatar May 01 '23 18:05 barneysowood

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

ggiesen avatar Jul 17 '23 21:07 ggiesen

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 avatar Jul 17 '23 21:07 ggiesen

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

ggiesen avatar Jul 18 '23 18:07 ggiesen

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).

Sxderp avatar Oct 03 '23 14:10 Sxderp