Created
March 27, 2017 11:00
-
-
Save hemebond/d5ed255f6658ada4309e6edba4037355 to your computer and use it in GitHub Desktop.
Render a YAML file using the Saltstack Python renderer
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
#!py | |
# test.sls | |
import yaml | |
def run(): | |
config = {} | |
map_file = __salt__.cp.cache_file("salt://formula/map.yaml") | |
try: | |
with open(map_file, "rb") as f: | |
map = yaml.safe_load(f.read()) | |
except Exception as e: | |
print(e) | |
map = {} | |
config = __salt__.grains.filter_by(map, | |
# merge=__salt__.pillar.get('formula:lookup'), | |
default='default', | |
base='default') | |
print(config) | |
return {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment