Created
January 31, 2014 18:05
-
-
Save mgwilliams/8738878 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
Special CSV outputter for grains ;-) | |
''' | |
# Define the module's virtual name | |
__virtualname__ = 'csv' | |
def __virtual__(): | |
return __virtualname__ | |
def output(grains): | |
''' | |
Output the grains in a "special" way | |
''' | |
ret = '' | |
for id_, minion in grains.items(): | |
for key in sorted(minion): | |
ret += '{0},{1},"{2}"\n'.format(id_, key, minion[key]) | |
return ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment