| {%- from "salt/map.jinja" import master with context %} |
| {%- if master.enabled %} |
| {%- for environment_name, environment in master.get('environment', {}).iteritems() %} |
| {%- set formulas = environment.get('formula', {}) %} |
| {%- set priorities = {'orchestration':{'deploy':{'applications':{}}}} %} |
| {%- for formula_name, formula in formulas.iteritems() %} |
| {%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %} |
| {%- set orch_fragment_file = formula_name+'/meta/salt.yml' %} |
| {%- macro load_orch_file() %}{% include orch_fragment_file %}{% endmacro %} |
| {%- set orch_yaml = load_orch_file()|load_yaml %} |
| {%- if orch_yaml.orchestration is defined %} |
| {%- do priorities['orchestration']['deploy']['applications'].update({ formula_name: orch_yaml['orchestration']['deploy']['applications'][formula_name] }) %} |
| {%- endif %} |
| {%- endif %} |
| {%- endfor %} |
| {%- if priorities.orchestration.deploy.applications -%} |
| {{ priorities|yaml(False) }} |
| {%- endif %} |
| {%- endfor %} |
| {%- endif %} |