Browse Source

Revert PR #200

This restores the original structure/behavior of the
`salt_formulas` Pillar key.
tags/v0.57.0
Matthew X. Economou 8 years ago
parent
commit
e8021220b8
3 changed files with 11 additions and 13 deletions
  1. +8
    -7
      pillar.example
  2. +1
    -3
      salt/formulas.jinja
  3. +2
    -3
      salt/formulas.sls

+ 8
- 7
pillar.example View File

# environment, if an option is missing in a given environment, the # environment, if an option is missing in a given environment, the
# value from "default" is used instead. # value from "default" is used instead.
default: default:
# URL where the formulas git repositories are downloaded from
# it will be suffixed with <formula-name>.git
baseurl: https://github.com/saltstack-formulas
# Directory where Git repositories are downloaded # Directory where Git repositories are downloaded
basedir: /srv/formulas basedir: /srv/formulas
# Update the git repository to the latest version (False by default) # Update the git repository to the latest version (False by default)
# List of formulas to enable in each environment # List of formulas to enable in each environment
list: list:
base: base:
https://github.com/saltstack-formulas:
- salt-formula
- postfix-formula
- salt-formula
- postfix-formula
dev: dev:
https://github.com/saltstack-formulas:
- salt-formula
- postfix-formula
- openssh-formula
- salt-formula
- postfix-formula
- openssh-formula

+ 1
- 3
salt/formulas.jinja View File



{%- macro formulas_roots(env) -%} {%- macro formulas_roots(env) -%}
{%- set value = [] -%} {%- set value = [] -%}
{%- for repo,f_name in formulas.get(env, {}).items() -%}
{%- for dir in f_name -%}
{%- for dir in formulas.get(env, []) -%}
{%- set basedir = formulas_git_opt(env, 'basedir')|load_yaml -%} {%- set basedir = formulas_git_opt(env, 'basedir')|load_yaml -%}
{%- do value.append('{0}/{1}'.format(basedir, dir)) -%} {%- do value.append('{0}/{1}'.format(basedir, dir)) -%}
{%- endfor -%} {%- endfor -%}
{%- endfor -%}
{{ value|yaml }} {{ value|yaml }}
{%- endmacro -%} {%- endmacro -%}



+ 2
- 3
salt/formulas.sls View File

{% from "salt/formulas.jinja" import formulas_git_opt with context %} {% from "salt/formulas.jinja" import formulas_git_opt with context %}


# Loop over all formulas listed in pillar data # Loop over all formulas listed in pillar data
{% for env, elements in salt['pillar.get']('salt_formulas:list', {}).items() %}
{% for baseurl, entries in elements.items() %}
{% for env, entries in salt['pillar.get']('salt_formulas:list', {}).items() %}
{% for entry in entries %} {% for entry in entries %}


{% set basedir = formulas_git_opt(env, 'basedir')|load_yaml %} {% set basedir = formulas_git_opt(env, 'basedir')|load_yaml %}
{% if gitdir not in processed_gitdirs %} {% if gitdir not in processed_gitdirs %}
{% do processed_gitdirs.append(gitdir) %} {% do processed_gitdirs.append(gitdir) %}
{% set options = formulas_git_opt(env, 'options')|load_yaml %} {% set options = formulas_git_opt(env, 'options')|load_yaml %}
{% set baseurl = formulas_git_opt(env, 'baseurl')|load_yaml %}
{{ gitdir }}: {{ gitdir }}:
git.latest: git.latest:
- name: {{ baseurl }}/{{ entry }}.git - name: {{ baseurl }}/{{ entry }}.git


{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endfor %}

Loading…
Cancel
Save