Improve applying condition for SALT_MODELS_SYSTEM_TAG
SALT_MODELS_SYSTEM_TAG was applied only if SALT_MODELS_SYSTEM_COMMIT
is not empty.
Change applying order:
1. SALT_MODELS_SYSTEM_COMMIT, if set
2. else SALT_MODELS_SYSTEM_REF_CHANGE, if set
3. else SALT_MODELS_SYSTEM_TAG
Change-Id: I136abee7d2a76c97ac696d50877abe686449cd5c
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index b71da48..9084609 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -238,23 +238,24 @@
{%- elif SALT_MODELS_COMMIT != 'master' %}
git checkout {{ SALT_MODELS_COMMIT }};
{%- endif %}
+
{%- if SALT_MODELS_SYSTEM_COMMIT != '' %}
pushd classes/system/;
git checkout {{ SALT_MODELS_SYSTEM_COMMIT }};
popd;
- {%- if SALT_MODELS_SYSTEM_TAG != '' %}
- pushd classes/system/;
- git fetch --all --tags --prune
- git checkout tags/{{ SALT_MODELS_SYSTEM_TAG }};
- popd;
- {%- endif %}
{%- elif SALT_MODELS_SYSTEM_REF_CHANGE != '' %}
pushd classes/system/ && \
{%- for item in SALT_MODELS_SYSTEM_REF_CHANGE.split(" ") %}
git fetch {{ SALT_MODELS_SYSTEM_REPOSITORY }} {{ item }} && git cherry-pick FETCH_HEAD;
{%- endfor %}
popd;
+ {%- elif SALT_MODELS_SYSTEM_TAG != '' %}
+ pushd classes/system/;
+ git fetch --all --tags --prune
+ git checkout tags/{{ SALT_MODELS_SYSTEM_TAG }};
+ popd;
{%- endif %}
+
popd;
mkdir -p /srv/salt/reclass/classes/service;
mkdir -p /srv/salt/reclass/nodes/_generated/;
@@ -354,11 +355,10 @@
echo "SALT_MODELS_SYSTEM_REPOSITORY={{ SALT_MODELS_SYSTEM_REPOSITORY }}"
{%- if SALT_MODELS_SYSTEM_COMMIT != '' %}
echo "SALT_MODELS_SYSTEM_COMMIT={{ SALT_MODELS_SYSTEM_COMMIT }}"
- {%- if SALT_MODELS_SYSTEM_TAG != '' %}
- echo "SALT_MODELS_SYSTEM_TAG={{ SALT_MODELS_SYSTEM_TAG }}"
- {%- endif %}
{%- elif SALT_MODELS_SYSTEM_REF_CHANGE != '' %}
echo "SALT_MODELS_SYSTEM_REF_CHANGE={{ SALT_MODELS_SYSTEM_REF_CHANGE }}"
+ {%- elif SALT_MODELS_SYSTEM_TAG != '' %}
+ echo "SALT_MODELS_SYSTEM_TAG={{ SALT_MODELS_SYSTEM_TAG }}"
{%- endif %}
echo "======================================="
node_name: {{ HOSTNAME_CFG01 }}
@@ -453,18 +453,17 @@
pushd /srv/salt/reclass/classes/system/
git checkout {{ SALT_MODELS_SYSTEM_COMMIT }};
popd;
- {%- if SALT_MODELS_SYSTEM_TAG != '' %}
- pushd /srv/salt/reclass/classes/system/
- git fetch --all --tags --prune
- git checkout tags/{{ SALT_MODELS_SYSTEM_TAG }};
- popd;
- {%- endif %}
{%- elif SALT_MODELS_SYSTEM_REF_CHANGE != '' %}
pushd /srv/salt/reclass/classes/system/ && \
{%- for item in SALT_MODELS_SYSTEM_REF_CHANGE.split(" ") %}
git fetch {{ SALT_MODELS_SYSTEM_REPOSITORY }} {{ item }} && git cherry-pick FETCH_HEAD;
{%- endfor %}
popd;
+ {%- elif SALT_MODELS_SYSTEM_TAG != '' %}
+ pushd /srv/salt/reclass/classes/system/
+ git fetch --all --tags --prune
+ git checkout tags/{{ SALT_MODELS_SYSTEM_TAG }};
+ popd;
{%- endif %}
{%- if IS_CONTRAIL_LAB %}