Enable update repo before formulas install
Change-Id: Ia8de6b72c1a352deaee49e3e5983b82f47beb37d
diff --git a/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-pike-ovs-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-pike-ovs-maas.yaml
index 49f91da..cb12b3f 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-pike-ovs-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-pike-ovs-maas.yaml
@@ -19,6 +19,10 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml
index 6369346..697f99d 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml
@@ -19,6 +19,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_UPLOAD_AND_IMPORT_GPG_ENCRYPTION_KEY() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-dvr-vxlan.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-dvr-vxlan.yaml
index e6c7313..3db5e4e 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-dvr-vxlan.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-dvr-vxlan.yaml
@@ -13,6 +13,9 @@
{% import 'shared-salt.yaml' as SHARED with context %}
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-k8s-contrail40-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-k8s-contrail40-maas.yaml
index 52098cf..0943346 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-k8s-contrail40-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-k8s-contrail40-maas.yaml
@@ -17,6 +17,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-os-contrail40-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-os-contrail40-maas.yaml
index 3f8102b..951d6fa 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-os-contrail40-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-os-contrail40-maas.yaml
@@ -17,6 +17,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-queens-contrail-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-queens-contrail-maas.yaml
index 5c65691..0ff7c82 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-queens-contrail-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-bm-queens-contrail-maas.yaml
@@ -17,6 +17,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml
index 08c2df1..5da87d1 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_UPLOAD_AND_IMPORT_GPG_ENCRYPTION_KEY() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml
index 51e7b5f..4233f9c 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-system.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-system.yaml
index e8a2c85..4b0c57d 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-system.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-system.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-ovs-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-ovs-maas.yaml
index f2729fa..4d554c4 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-ovs-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-ovs-maas.yaml
@@ -19,6 +19,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-pike-dvr-ceph.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-pike-dvr-ceph.yaml
index 25c1f9a..4b2b12f 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-pike-dvr-ceph.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-pike-dvr-ceph.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-queens-dvr-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-queens-dvr-sl.yaml
index 2eb94c1..3264b5c 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-queens-dvr-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-queens-dvr-sl.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-calico-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-calico-sl.yaml
index 4aaa2bf..2b07452 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-calico-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-calico-sl.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_UPLOAD_AND_IMPORT_GPG_ENCRYPTION_KEY() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-contrail41-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-contrail41-sl.yaml
index 84b9aac..b04ba9d 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-contrail41-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-contrail41-sl.yaml
@@ -17,6 +17,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-genie.yaml b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-genie.yaml
index 62f2467..b6d2472 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-genie.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-k8s-genie.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-contrail41-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-contrail41-sl.yaml
index 3205e42..1d0bae8 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-contrail41-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-contrail41-sl.yaml
@@ -17,6 +17,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-dvr-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-dvr-sl.yaml
index ba8a4f4..51cb8fd 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-dvr-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-pike-dvr-sl.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-queens-dvr-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-queens-dvr-sl.yaml
index 1011916..eefc22d 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-queens-dvr-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_heat-cicd-queens-dvr-sl.yaml
@@ -12,6 +12,8 @@
{{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
+{{ SHARED.MACRO_INSTALL_FORMULAS_FROM_UPDATE() }}
+
{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
{{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 1a955b2..904a562 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -21,8 +21,11 @@
# Currently we support 2 salt version that can be set over bellow var
{% set SALT_VERSION = os_env('SALT_VERSION','2017.7') %}
{% set REPOSITORY_SUITE = os_env('REPOSITORY_SUITE', 'testing') %}
+{% set UPDATE_REPO_CUSTOM_TAG = os_env('UPDATE_REPO_CUSTOM_TAG', '') %}
+{% set UPDATE_VERSION = os_env('UPDATE_VERSION', 'proposed') %}
{# set FORMULA_REPOSITORY = os_env('FORMULA_REPOSITORY', 'deb [arch=amd64] http://apt.mirantis.com/${DISTRIB_CODENAME} ' + REPOSITORY_SUITE + ' salt extra') #}
{% set FORMULA_REPOSITORY = os_env('FORMULA_REPOSITORY', "deb [arch=amd64] http://mirror.mirantis.com/" + REPOSITORY_SUITE + "/salt-formulas"+"/${DISTRIB_CODENAME} ${DISTRIB_CODENAME} main") %}
+{% set UPDATE_FORMULA_REPOSITORY = os_env('UPDATE_FORMULA_REPOSITORY', "deb [arch=amd64] http://mirror.mirantis.com/update/" + UPDATE_VERSION + "/salt-formulas"+"/${DISTRIB_CODENAME} ${DISTRIB_CODENAME} main") %}
{# set FORMULA_GPG = os_env('FORMULA_GPG', 'http://apt.mirantis.com/public.gpg') #}
{% set FORMULA_GPG = os_env('FORMULA_GPG', "http://mirror.mirantis.com/" + REPOSITORY_SUITE + "/salt-formulas/xenial/archive-salt-formulas.key") %}
{# set SALT_REPOSITORY = os_env('SALT_REPOSITORY', "deb [arch=amd64] http://apt.mirantis.com/${DISTRIB_CODENAME}/salt/2016.3 " + REPOSITORY_SUITE + " main") #}
@@ -35,7 +38,6 @@
{% set UBUNTU_SECURITY_REPOSITORY = os_env('UBUNTU_SECURITY_REPOSITORY', "deb [arch=amd64] http://mirror.mirantis.com/" + REPOSITORY_SUITE + "/ubuntu/ ${DISTRIB_CODENAME}-security main restricted universe") %}
{% set UBUNTU_KEY_SERVER = os_env('UBUNTU_KEY_SERVER', 'keyserver.ubuntu.com') %}
{% set UBUNTU_KEY_ID = os_env('UBUNTU_KEY_ID', '0E08A149DE57BFBE') %}
-{% set UPDATE_REPO_CUSTOM_TAG = os_env('UPDATE_REPO_CUSTOM_TAG', '') %}
{# Address pools for reclass cluster model are taken in the following order:
# 1. environment variables,
@@ -90,6 +92,25 @@
{%- endmacro %}
+{%- macro MACRO_INSTALL_FORMULAS_FROM_UPDATE() %}
+{#####################################################}
+
+- description: 'Configure key on nodes and install packages'
+ cmd: |
+ rm -rf trusted* ;
+ rm -rf /etc/apt/sources.list ;
+ . /etc/lsb-release; # Get DISTRIB_CODENAME variable
+ echo "{{ UPDATE_FORMULA_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_update_salt.list;
+ wget -O - "{{ FORMULA_GPG }}" | apt-key add -;
+ eatmydata apt-get clean;
+ apt-get update;
+ sync;
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+
+{%- endmacro %}
+
{%- macro MACRO_INSTALL_SALT_MASTER() %}
{######################################}
- description: Installing salt master on cfg01