Skip to content

Instantly share code, notes, and snippets.

@t0mk
Created August 31, 2015 12:43
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 t0mk/09b08d4d6a9d3c8e0edf to your computer and use it in GitHub Desktop.
Save t0mk/09b08d4d6a9d3c8e0edf to your computer and use it in GitHub Desktop.
apps fact
#!/home/core/bin/python
APP_PATH = '/apps'
CONFIG = 'config.yml'
import os
import yaml
import json
import subprocess
result = {}
for d in os.listdir(APP_PATH):
if d.startswith('.'):
continue
result[d] = None
try:
with open(os.path.join(APP_PATH, d, CONFIG)) as f:
result[d] = yaml.load(f)
cwd = os.getcwd()
os.chdir(os.path.join(APP_PATH, d))
comm = "git config --get remote.origin.url"
result[d]['repourl'] = subprocess.check_output(comm.split()).strip()
os.chdir(cwd)
except Exception as e:
print e
print json.dumps(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment