drive-ops/global/overlay/etc/puppet/cosmos_enc.py

19 lines
391 B
Python
Raw Normal View History

2013-09-02 14:01:50 +00:00
#!/usr/bin/env python
import sys
import yaml
import os
import re
node_name = sys.argv[1]
2014-02-22 20:43:18 +00:00
db_file = os.environ.get("COSMOS_ENC_DB","/etc/puppet/cosmos-db.yaml")
db = dict(classes=dict())
if os.path.exists(db_file):
with open(db_file) as fd:
db.update(yaml.load(fd))
2013-09-02 14:01:50 +00:00
2014-02-22 20:43:18 +00:00
print yaml.dump(dict(classes=db['classes'].get(node_name,dict()),parameters=dict(roles=db.get('members',[]))))
2013-09-02 14:01:50 +00:00