-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Extending SaltStack
By :
When the salt command is used, any return data that is received during the wait period will be displayed to the user. Outputter modules are used in this case to display that data to the console (or more accurately, to STDOUT), usually in a format that is somewhat user-friendly.
Because Salt already ships with a json outputter, we'll take advantage of the fact that output data is technically going to STDOUT, and put together an outputter that uses a serializer (pickle) that may dump binary data:
'''
Pickle outputter
This file should be saved as salt/output/pickle.py
'''
from __future__ import absolute_import
import pickle
def output(data):
'''
Dump out data in pickle format
'''
return pickle.dumps(data)This outputter is about as simple as it gets. The only required function is called output(), and it accepts a dictionary. It doesn't matter what the dictionary is called, so long as the function has one defined.
The pickle library...
Change the font size
Change margin width
Change background colour