Skip to content

Instantly share code, notes, and snippets.

for configDict in yaml.load_all(stream):
if configDict['instance']['id'] == instance:
#assign local variables
TEST_CONFIG_FILE.write("id: " + configDict['instance']['saltId'] + "\n")
yaml.dump(configDict['instance']['grains'], TEST_CONFIG_FILE)
TEST_CONFIG_FILE.close()
instance = getInstanceId()
stream = file('db.yml', 'r')
myDict = yaml.load(stream)
if myDict.has_key('instance') == True:
for key in myDict:
print "key:" + key + " " + "value: " + myDict[key] + "\n"
import os,sys,logging
#logging.basicConfig(level=logging.DEBUG)
#TODO this is currently not working, need to fix returning grain
def file_get_contents(filename):
content = ""
if os.path.exists(filename):
fp = open(filename, "r")
content = fp.read()
fp.close()
__description__ = "Salt Grain for gathering an environment variable"
import os,sys,logging
#logging.basicConfig(level=logging.DEBUG)
from pprint import pprint
def _file_get_contents(filename):
if os.path.exists(filename):
content = {}
with open(filename, "r") as _file:
]# rpm -ql python26
/etc/rpm/macros.python26
/usr/bin/pydoc26
/usr/bin/python2.6
/usr/bin/python26
/usr/include/python2.6
/usr/include/python2.6/pyconfig-64.h
/usr/lib/python2.6
/usr/lib/python2.6/site-packages
/usr/lib/rpm/brp-multiple-python-bytecompile