saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.14k stars 5.47k forks source link

zpool.list parsable argument does nothing #61711

Open clallen opened 2 years ago

clallen commented 2 years ago

Description Output from the zpool.list command is identical no matter what the parsable argument is set to.

Setup Running salt-call locally on a SPARC/Solaris minion machine.

Steps to Reproduce the behavior

# salt-call zpool.list parsable=True
local:
    ----------
    orapool:
        ----------
        size:
            199G
        alloc:
            50.4G
        free:
            149G
        cap:
            25%
        health:
            ONLINE
    rpool:
        ----------
        size:
            49.8G
        alloc:
            23.1G
        free:
            26.6G
        cap:
            46%
        health:
            ONLINE
    swappool:
        ----------
        size:
            49.8G
        alloc:
            32G
        free:
            17.7G
        cap:
            64%
        health:
            ONLINE

# salt-call zpool.list parsable=False
local:
    ----------
    orapool:
        ----------
        size:
            199G
        alloc:
            50.4G
        free:
            149G
        cap:
            25%
        health:
            ONLINE
    rpool:
        ----------
        size:
            49.8G
        alloc:
            23.1G
        free:
            26.6G
        cap:
            46%
        health:
            ONLINE
    swappool:
        ----------
        size:
            49.8G
        alloc:
            32G
        free:
            17.7G
        cap:
            64%
        health:
            ONLINE

Expected behavior What the documentation says:

display numbers in parsable (exact) values

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ``` Salt Version: Salt: 3004 Dependency Versions: cffi: 1.14.0 cherrypy: 15.0.0 dateutil: 2.8.2 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.0.2 libgit2: Not Installed M2Crypto: Not Installed Mako: 1.1.2 msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.20 pycrypto: Not Installed pycryptodome: 3.11.0 pygit2: Not Installed Python: 3.7.10 (default, Sep 29 2021, 05:44:44) python-gnupg: Not Installed PyYAML: 6.0 PyZMQ: 21.0.2 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: solaris 11.4 locale: utf-8 machine: sun4v release: 5.11 system: SunOS version: Oracle Solaris 11.4 ```
network-shark commented 2 years ago

Interesting my output on freebsd looks like this .

sharky@salt:~ $ salt -V
Salt Version:
          Salt: 3004

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: 4.0.5
     gitpython: 3.1.14
        Jinja2: 2.11.3
       libgit2: 1.1.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.9.7
        pygit2: 1.4.0
        Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 20.0.0
         smmap: 4.0.0
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: debian 11 bullseye
        locale: utf-8
       machine: aarch64
       release: 5.10.63-v8+
        system: Linux
       version: Debian GNU/Linux 11 bullseye
sharky@salt:~ $ sudo salt 'freebsd'  zpool.list parsable=True
jid: 20220302221115731655
freebsd:
    ----------
    Storage:
        ----------
        alloc:
            9114951394263
        cap:
            76%
        frag:
            11%
        free:
            2847735115939
        health:
            ONLINE
        size:
            11984676742758
    data:
        ----------
        alloc:
            16965120819
        cap:
            32%
        frag:
            11%
        free:
            36185099468
        health:
            ONLINE
        size:
            53150220288
sharky@salt:~ $ sudo salt 'freebsd'  zpool.list
jid: 20220302221123456041
freebsd:
    ----------
    Storage:
        ----------
        alloc:
            9114951394263
        cap:
            76%
        frag:
            11%
        free:
            2847735115939
        health:
            ONLINE
        size:
            11984676742758
    data:
        ----------
        alloc:
            16965120819
        cap:
            32%
        frag:
            11%
        free:
            36185099468
        health:
            ONLINE
        size:
            53150220288

Looks like the same problem but the opposite way ?

Not sure if I understand it correctly , but parsable=True should return the exact bit or bytes value ?

clallen commented 2 years ago

I may be missing something, but it looks like your output is the same except for indentation.

My expectation was something like only numbers would be output for numeric values when using "parsable".

For example, this is the capacity property output normally:

zpool get capacity rpool

NAME PROPERTY VALUE SOURCE rpool capacity 18% -

And this is with the "-p" (parsable) argument:

zpool get -p capacity rpool

NAME PROPERTY VALUE SOURCE rpool capacity 18 -

From: network-shark @.> Sent: Wednesday, March 2, 2022 2:14 PM To: saltstack/salt @.> Cc: Clint Allen @.>; Author @.> Subject: [EXTERNAL] Re: [saltstack/salt] zpool.list parsable argument does nothing (Issue #61711)

Interesting my output on freebsd looks like this .

@.***:~ $ sudo salt 'freebsd' zpool.list parsable=True jid: 20220302221115731655 freebsd:

Storage:

alloc: 9114951394263 cap: 76% frag: 11% free: 2847735115939 health: ONLINE size: 11984676742758 data:

alloc: 16965120819 cap: 32% frag: 11% free: 36185099468 health: ONLINE size: 53150220288

@.***:~ $ sudo salt 'freebsd' zpool.list

jid: 20220302221123456041

freebsd:

----------

Storage:

    ----------

    alloc:

        9114951394263

    cap:

        76%

    frag:

        11%

    free:

        2847735115939

    health:

        ONLINE

    size:

        11984676742758

data:

    ----------

    alloc:

        16965120819

    cap:

        32%

    frag:

        11%

    free:

        36185099468

    health:

        ONLINE

    size:

        53150220288

Looks like the same problem but the opposite way ?

Not sure if I understand it correctly , but parsable=True should return the exact bit or bytes value ?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/saltstack/salt/issues/61711*issuecomment-1057448837__;Iw!!FbZ0ZwI3Qg!9KIbr80uOHaEnTaOpXSd_78iUPVnc9sr_Gh5n3MZSE9S1u4y56gAAuaUKNaCQw$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AELWAYPG7PKDLOZNASZZLATU57R3VANCNFSM5PFXMCEQ__;!!FbZ0ZwI3Qg!9KIbr80uOHaEnTaOpXSd_78iUPVnc9sr_Gh5n3MZSE9S1u4y56gAAubBdnnKvg$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https:/apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!FbZ0ZwI3Qg!9KIbr80uOHaEnTaOpXSd_78iUPVnc9sr_Gh5n3MZSE9S1u4y56gAAuZVGUEhug$ or Androidhttps://urldefense.com/v3/__https:/play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!FbZ0ZwI3Qg!9KIbr80uOHaEnTaOpXSd_78iUPVnc9sr_Gh5n3MZSE9S1u4y56gAAua1muxseA$. You are receiving this because you authored the thread.Message ID: @.**@.>>

INTERNAL - NI CONFIDENTIAL

OrangeDog commented 2 years ago

Using --out=json will make it easier to see what the exact types are.

garethgreenaway commented 1 year ago

Wondering if the issue with the different results is because of different versions of an underlying library or binary that is being used to gather the results?

garethgreenaway commented 1 year ago

@clallen @network-shark Just making sure you both saw the question in the previous comment. Thanks!

clallen commented 1 year ago

@garethgreenaway Yes, I would assume that the binaries on FreeBSD and Solaris are different. I don't really know anything about FreeBSD.

network-shark commented 1 year ago

@garethgreenaway freebsd is using openzfs