Generate models in /root/ instead of /tmp

Generate models on persistent storage to keep the files for
investigation after reboot

Change-Id: I30a7697db06aaff15a5746e2af73774578591ac9
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 36d68bb..b63b82d 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -327,12 +327,12 @@
 
 {%- macro MACRO_GENERATE_COOKIECUTTER_MODEL(IS_CONTRAIL_LAB=false, CONTROL_VLAN=None, TENANT_VLAN=None, CLUSTER_PRODUCT_MODELS='') %}
 {###################################################################}
-{%- set CLUSTER_CONTEXT_PATH = '/tmp/' + CLUSTER_CONTEXT_NAME %}
+{%- set CLUSTER_CONTEXT_PATH = '/root/' + CLUSTER_CONTEXT_NAME %}
 - description: "[EXPERIMENTAL] Upload cookiecutter-templates context to cfg01.{{ DOMAIN_NAME }}"
   upload:
     local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
     local_filename: {{ CLUSTER_CONTEXT_NAME }}
-    remote_path: /tmp/
+    remote_path: /root/
   node_name: {{ HOSTNAME_CFG01 }}
 
 - description: "Show options enabled in the context file for model generation"
@@ -370,18 +370,18 @@
     set -e;
     sudo apt-get install python-setuptools -y
     pip install cookiecutter
-    export GIT_SSL_NO_VERIFY=true; git clone {{ COOKIECUTTER_TEMPLATES_REPOSITORY }} /tmp/cookiecutter-templates
+    export GIT_SSL_NO_VERIFY=true; git clone {{ COOKIECUTTER_TEMPLATES_REPOSITORY }} /root/cookiecutter-templates
 
     {%- if COOKIECUTTER_TEMPLATE_COMMIT != '' %}
-    pushd /tmp/cookiecutter-templates
+    pushd /root/cookiecutter-templates
     git checkout {{ COOKIECUTTER_TEMPLATE_COMMIT }}
     popd
     {%- elif COOKIECUTTER_REF_CHANGE != '' %}
-    pushd /tmp/cookiecutter-templates
+    pushd /root/cookiecutter-templates
     git fetch {{ COOKIECUTTER_TEMPLATES_REPOSITORY }} {{ COOKIECUTTER_REF_CHANGE }} && git checkout FETCH_HEAD
     popd
     {%- elif COOKIECUTTER_TAG != '' %}
-    pushd /tmp/cookiecutter-templates
+    pushd /root/cookiecutter-templates
     git fetch --all --tags --prune
     git checkout tags/{{ COOKIECUTTER_TAG }}
     popd
@@ -409,7 +409,7 @@
     # 192.168.10 -> 10.16.0 (generated network for admin)
     # 10.16.0 -> <external network>
     # So let's replace constant networks to the keywords, and then keywords to the desired networks.
-    export REPLACE_DIRS="{{ CLUSTER_CONTEXT_PATH }} /tmp/cookiecutter-templates"
+    export REPLACE_DIRS="{{ CLUSTER_CONTEXT_PATH }} /root/cookiecutter-templates"
     find ${REPLACE_DIRS} -type f -exec sed -i 's/10\.167\.5/==IPV4_NET_ADMIN_PREFIX==/g' {} +
     find ${REPLACE_DIRS} -type f -exec sed -i 's/10\.167\.4/==IPV4_NET_CONTROL_PREFIX==/g' {} +
     find ${REPLACE_DIRS} -type f -exec sed -i 's/10\.167\.6/==IPV4_NET_TENANT_PREFIX==/g' {} +
@@ -420,10 +420,10 @@
     find ${REPLACE_DIRS} -type f -exec sed -i 's/==IPV4_NET_TENANT_PREFIX==/{{ IPV4_NET_TENANT_PREFIX }}/g' {} +
     find ${REPLACE_DIRS} -type f -exec sed -i 's/==IPV4_NET_EXTERNAL_PREFIX==/{{ IPV4_NET_EXTERNAL_PREFIX }}/g' {} +
 
-    {% set items = CLUSTER_PRODUCT_MODELS or '$(ls /tmp/cookiecutter-templates/cluster_product/)' %}
+    {% set items = CLUSTER_PRODUCT_MODELS or '$(ls /root/cookiecutter-templates/cluster_product/)' %}
     for item in {{ items }}; do
-      python /tmp/cookiecutter-templates/generate.py \
-        --template /tmp/cookiecutter-templates/cluster_product/$item \
+      python /root/cookiecutter-templates/generate.py \
+        --template /root/cookiecutter-templates/cluster_product/$item \
         --config-file {{ CLUSTER_CONTEXT_PATH }} \
         --output-dir /srv/salt/reclass/classes/cluster/;
     done
@@ -490,8 +490,8 @@
 - description: "[EXPERIMENTAL] Clone 'environment-template' repository to cfg01.{{ DOMAIN_NAME }}"
   cmd: |
     set -e;
-    mkdir -p /tmp/environment/;
-    export GIT_SSL_NO_VERIFY=true; git clone https://github.com/Mirantis/environment-template /tmp/environment/environment_template
+    mkdir -p /root/environment/;
+    export GIT_SSL_NO_VERIFY=true; git clone https://github.com/Mirantis/environment-template /root/environment/environment_template
   node_name: {{ HOSTNAME_CFG01 }}
   skip_fail: false
 
@@ -499,7 +499,7 @@
 - description: Fetch changes for environment templates
   cmd: |
     set -e;
-    pushd /tmp/environment/environment_template &&
+    pushd /root/environment/environment_template &&
     git fetch https://github.com/Mirantis/environment-template {{ ENVIRONMENT_TEMPLATE_REF_CHANGE }} &&
     git checkout FETCH_HEAD &&
     popd
@@ -512,7 +512,7 @@
   upload:
     local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
     local_filename: {{ ENVIRONMENT_CONTEXT_NAME }}
-    remote_path: /tmp/environment/
+    remote_path: /root/environment/
   node_name: {{ HOSTNAME_CFG01 }}
 {%- endfor %}
 
@@ -549,9 +549,9 @@
   cmd: |
     set -e;
     . /root/venv-reclass-tools/bin/activate;
-    reclass-tools render --template-dir /tmp/environment/environment_template/ \
+    reclass-tools render --template-dir /root/environment/environment_template/ \
                          --output-dir /srv/salt/reclass/classes/environment/ \
-                         {% for ENVIRONMENT_CONTEXT_NAME in ENVIRONMENT_CONTEXT_NAMES %} --context /tmp/environment/{{ENVIRONMENT_CONTEXT_NAME}}{% endfor %} \
+                         {% for ENVIRONMENT_CONTEXT_NAME in ENVIRONMENT_CONTEXT_NAMES %} --context /root/environment/{{ENVIRONMENT_CONTEXT_NAME}}{% endfor %} \
                          --env-name {{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}