From 87c4e89856193aea7b58ca88f629476d5029715f Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Nov 19 2017 20:12:02 +0000 Subject: use the built-in variable "saltenv" in top.sls --- diff --git a/bin/prepare_test_show_highstate_env.sh b/bin/prepare_test_show_highstate_env.sh index fe68558..09f2133 100755 --- a/bin/prepare_test_show_highstate_env.sh +++ b/bin/prepare_test_show_highstate_env.sh @@ -39,6 +39,5 @@ $SUDO ln -s $PWD/pillar /srv/pillar ID=$(hostname -f) ROLES=$(bin/get_roles.py --yaml) printf "city:\ncountry:\ndomain: infra.opensuse.org\nosfullname:\nosmajorrelease:\nosrelease_info:\n$ROLES\nsalt_cluster: opensuse\nvirt_cluster:\n" | $SUDO tee /etc/salt/grains > /dev/null -sed -i -e 's/^production:$/base:/' /srv/{salt,pillar}/top.sls touch pillar/id/${ID//./_}.sls [[ -n $STRIP_SECRETS ]] && sed -i -e "s#\- secrets\..*#- id.${ID//./_}#g" $(grep -lr "\- secrets\." pillar) diff --git a/bin/run_tests_locally.sh b/bin/run_tests_locally.sh index ba986f1..a41e681 100755 --- a/bin/run_tests_locally.sh +++ b/bin/run_tests_locally.sh @@ -47,7 +47,6 @@ LC_ALL=C bin/test_show_highstate.sh # Cleanup bin/get_formulas.py --destination $DESTINATION --remove-symlinks --checkout origin/master -sed -i -e 's/^base:$/production:/' /srv/{salt,pillar}/top.sls for dir in ${SALT_DIRS[@]}; do sudo chown -R root: $dir done diff --git a/pillar/top.sls b/pillar/top.sls index 2680eda..0e88ccc 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -9,7 +9,7 @@ {% set virt_cluster = salt['grains.get']('virt_cluster') %} {% set virtual = salt['grains.get']('virtual') %} -production: +{{ saltenv }}: '*': - common {% for role in roles %} diff --git a/salt/top.sls b/salt/top.sls index d8d0d69..cfc2fd1 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -1,7 +1,7 @@ {% from "macros.jinja" import include_optional with context %} {% set roles = salt['pillar.get']('grains:roles', []) %} -production: +{{ saltenv }}: '*': - role.base {% for role in roles %}