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
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() |
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
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" |
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
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() |
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
__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: |
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
]# 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 |