Created
April 16, 2015 22:42
-
-
Save iggy/93c65ca26ea6c7eff144 to your computer and use it in GitHub Desktop.
dict merging hurts my eyes
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
{% import_yaml "mongodb/defaults.yaml" as defaults %} | |
{% import_yaml "mongodb/osmap.yaml" as osmap %} | |
{% import_yaml "mongodb/codenamemap.yaml" as codemap %} | |
{# get the settings for the os_family grain #} | |
{% set osfam = salt['grains.filter_by'](osmap) %} | |
{# get the settings for the oscodename grain, os_family data will override | |
oscodename data #} | |
{% set oscode = salt['grains.filter_by'](codemap, | |
grain='oscodename', | |
merge=osfam) %} | |
{# merge the os family/codename specific data over the defaults #} | |
{% do defaults.mongodb.update(oscode) %} | |
{# merge the pillar:lookup dict into the defaults/os specific dict #} | |
{% set lookup = salt['pillar.get']('mongodb:lookup', default=defaults.mongodb, merge=True) %} | |
{# merge the actual mongodb pillar into the above combined dict #} | |
{% set mdb = salt['pillar.get']('mongodb', default=lookup, merge=True) %} | |
{# this hopefully goes away soon #} | |
{% set ms = salt['pillar.get']('mongos', default=defaults.mongos, merge=True) %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment