mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add modular output directory
This commit is contained in:
parent
8c01f7e566
commit
90f234578a
17
salt/output/__init__.py
Normal file
17
salt/output/__init__.py
Normal file
@ -0,0 +1,17 @@
|
||||
'''
|
||||
Used to manage the outputter system. This package is the modular system used
|
||||
for managing outputters.
|
||||
'''
|
||||
|
||||
import salt.loader
|
||||
|
||||
def display_output(data, out, opts=None):
|
||||
'''
|
||||
Print the passed data using the desired output
|
||||
'''
|
||||
if opts is None:
|
||||
opts = {}
|
||||
outputters = salt.loader.outputters(opts)
|
||||
if not out in outputters:
|
||||
outputters['pprint'](data)
|
||||
outputters[out](data)
|
18
salt/output/pprint_out.py
Normal file
18
salt/output/pprint_out.py
Normal file
@ -0,0 +1,18 @@
|
||||
'''
|
||||
The default outputter, just fall back to python pretty print
|
||||
'''
|
||||
|
||||
# Import python libs
|
||||
import pprint
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Change the name to pprint
|
||||
'''
|
||||
return 'pprint'
|
||||
|
||||
def output(data):
|
||||
'''
|
||||
Print out via pretty print
|
||||
'''
|
||||
pprint.pprint(data)
|
Loading…
Reference in New Issue
Block a user