Writing outputter modules

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.

Pickling our output

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) ...

Get Extending SaltStack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.