Skip to content

Instantly share code, notes, and snippets.

@zippyz
Created October 18, 2012 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zippyz/3909323 to your computer and use it in GitHub Desktop.
Save zippyz/3909323 to your computer and use it in GitHub Desktop.
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()
return content
# Provides:
# osrelease
# oscodename
def return_grains():
grains = {}
filename = "/environment"
#grains = file_get_contents(filename)
grains['env_grain'] = file_get_contents(filename)
if 'env_grain':
return grains
return {}
def main():
return_grains()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment