Last active
August 29, 2015 14:19
-
-
Save stbenjam/30868e675d0eeae8d337 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import json | |
import os | |
import sys | |
import salt.config | |
import salt.runner | |
if __name__ == '__main__': | |
__opts__ = salt.config.master_config( | |
os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/minion')) | |
runner = salt.runner.Runner(__opts__) | |
stdout_bak = sys.stdout | |
with open(os.devnull, 'wb') as f: | |
sys.stdout = f | |
ret = runner.cmd('cache.grains', [os.environ.get('SALT_MINION')] | |
sys.stdout = stdout_bak | |
print json.dumps(ret) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment