diff options
author | Leif Johansson <leifj@sunet.se> | 2014-02-22 21:43:18 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2014-02-22 21:43:18 +0100 |
commit | 31772848b3dfcf53971ae1a98020e1ff8875aa90 (patch) | |
tree | 623e644e57cec8d6956fe692ea22b69f5db77f59 /global/overlay/etc | |
parent | 67337f5c7cba477b9e4a37d0e85ca5b0e7426f65 (diff) | |
parent | 9b801d3be8e0268994169729cf5d5dd4600367cb (diff) |
merged pull-request
Diffstat (limited to 'global/overlay/etc')
-rwxr-xr-x | global/overlay/etc/puppet/cosmos_enc.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/global/overlay/etc/puppet/cosmos_enc.py b/global/overlay/etc/puppet/cosmos_enc.py index 63c3a66..131d161 100755 --- a/global/overlay/etc/puppet/cosmos_enc.py +++ b/global/overlay/etc/puppet/cosmos_enc.py @@ -5,20 +5,14 @@ import yaml import os import re -rules_path = os.environ.get("COSMOS_RULES_PATH","/etc/puppet") - node_name = sys.argv[1] -rules = dict() -for p in rules_path.split(":"): - rules_file = os.path.join(p,"cosmos-rules.yaml") - if os.path.exists(rules_file): - with open(rules_file) as fd: - rules.update(yaml.load(fd)) +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)) -classes = dict() -for reg,cls in rules.iteritems(): - if re.search(reg,node_name): - classes.update(cls) +print yaml.dump(dict(classes=db['classes'].get(node_name,dict()),parameters=dict(roles=db.get('members',[])))) -print yaml.dump(dict(classes=classes)) |