salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-run compact outputter (--out=compact) broken

Open aabognah opened this issue 10 years ago • 3 comments

Description of Issue/Question

The compact outputter option (--out=compact) seems to be broken.

Error message:

  File "/usr/lib/python2.7/site-packages/salt/output/compact.py", line 23, in output
    if data[min_][process]['result'] is False:
TypeError: string indices must be integers, not str

Steps to Reproduce Issue

run:

salt-run jobs.list_job jid --out=compact

You will get:

[ERROR   ] An un-handled exception was caught by salt's global exception handler:
TypeError: string indices must be integers, not str
Traceback (most recent call last):
  File "/usr/bin/salt-run", line 10, in <module>
    salt_run()
  File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 368, in salt_run
    client.run()
  File "/usr/lib/python2.7/site-packages/salt/cli/run.py", line 41, in run
    ret = runner.run()
  File "/usr/lib/python2.7/site-packages/salt/runner.py", line 181, in run
    False)  # Don't daemonize
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 422, in _proc_function
    return self.low(fun, low)
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 359, in low
    namespaced_event.fire_event(data, 'ret')
  File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 778, in fire_event
    self.print_func(tag, data)
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 500, in print_async_event
    salt.output.display_output(event_data, outputter, self.opts)
  File "/usr/lib/python2.7/site-packages/salt/output/__init__.py", line 86, in display_output
    display_data = try_printout(data, out, opts)
  File "/usr/lib/python2.7/site-packages/salt/output/__init__.py", line 39, in try_printout
    return get_printout(out, opts)(data).rstrip()
  File "/usr/lib/python2.7/site-packages/salt/output/compact.py", line 23, in output
    if data[min_][process]['result'] is False:
TypeError: string indices must be integers, not str
Traceback (most recent call last):
  File "/usr/bin/salt-run", line 10, in <module>
    salt_run()
  File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 368, in salt_run
    client.run()
  File "/usr/lib/python2.7/site-packages/salt/cli/run.py", line 41, in run
    ret = runner.run()
  File "/usr/lib/python2.7/site-packages/salt/runner.py", line 181, in run
    False)  # Don't daemonize
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 422, in _proc_function
    return self.low(fun, low)
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 359, in low
    namespaced_event.fire_event(data, 'ret')
  File "/usr/lib/python2.7/site-packages/salt/utils/event.py", line 778, in fire_event
    self.print_func(tag, data)
  File "/usr/lib/python2.7/site-packages/salt/client/mixins.py", line 500, in print_async_event
    salt.output.display_output(event_data, outputter, self.opts)
  File "/usr/lib/python2.7/site-packages/salt/output/__init__.py", line 86, in display_output
    display_data = try_printout(data, out, opts)
  File "/usr/lib/python2.7/site-packages/salt/output/__init__.py", line 39, in try_printout
    return get_printout(out, opts)(data).rstrip()
  File "/usr/lib/python2.7/site-packages/salt/output/compact.py", line 23, in output
    if data[min_][process]['result'] is False:

Versions Report

[root@gru-mc ~]# salt --versions-report
Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: 0.8.6
       cherrypy: 3.2.2
       dateutil: 1.5
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.21.0
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: 1.2.3
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.21.4
         Python: 2.7.5 (default, Oct 11 2015, 17:47:16)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: redhat 7.2 Maipo
        machine: x86_64
        release: 3.10.0-327.13.1.el7.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 7.2 Maipo

aabognah avatar Aug 04 '16 17:08 aabognah

Hi @aabognah - this is essentially a duplicate of #18614. The compact outputter has never worked officially. However, I have posted some other options in that issue that should get you close to what you're looking for. Can you take a look at those suggestions and make sure I've covered all of the use cases that the compact outputter was supposed to cover?

rallytime avatar Aug 04 '16 17:08 rallytime

Hi @rallytime . Thanks for the quick response. good to know that its not just me facing this issue. I'll add my questions to the original post.

aabognah avatar Aug 04 '16 17:08 aabognah

Ah, I forgot to come back around here and close this. The compact outputter has been removed in #35918.

rallytime avatar Nov 04 '16 22:11 rallytime