saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.22k stars 5.49k forks source link

key outputter broken #4098

Closed Mrten closed 11 years ago

Mrten commented 11 years ago
root@salt-master:/home/salt/pillar# salt -G 'virtual:physical' --out key test.ping
Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 102, in salt_main
    client.run()
  File "/usr/lib/pymodules/python2.7/salt/cli/__init__.py", line 109, in run
    self._output_ret(ret, out)
  File "/usr/lib/pymodules/python2.7/salt/cli/__init__.py", line 124, in _output_ret
    salt.output.display_output(ret, out, self.config)
  File "/usr/lib/pymodules/python2.7/salt/output/__init__.py", line 25, in display_output
    print(get_printout('pprint', opts)(data).rstrip())
  File "/usr/lib/pymodules/python2.7/salt/output/key.py", line 39, in output
    ret += '{0}\n'.format(trans[status])
KeyError: 'idd0011'

Dunno what the format should be, I was just testing different output formats.

giantlock commented 11 years ago

As https://salt.readthedocs.org/en/latest/ref/output/all/salt.output.key.html says: "This outputter is geared towards ingesting very specific data and should only be used with the salt-key command."

Mrten commented 11 years ago

The manpage says no such thing (ok, it does, though only implicitly for 'key'), but really, salt (the executable) should check if the data conforms to the 'very specific' formatting instead of bombing out (Can you tell I like my input data validated? Years of PHP programming does that to you :smiley: ).

giantlock commented 11 years ago

yes, i agree :)

thatch45 commented 11 years ago

Hmm, I did add in a check for tracebacks to default the call to netsed, I will get this fixed, thanks!

thatch45 commented 11 years ago

@Mrten, what version is this btw?

thatch45 commented 11 years ago

Got it :)