Allow to use existing cfg01 inventory file

If a model (generated from cookiecutter templates) contains
pre-generated nodes/_generated/cfg01.<domain name>.yml file,
do not overwrite it during deployment.

Change-Id: I10e197fffa20d58b6866e5a4e553ca1697e77f93
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 8fc2ae2..0cd2483 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -210,8 +210,9 @@
     find {{ CLUSTER_PATH }} -type f -exec sed -i 's/cluster_name: .*/cluster_name: {{ CLUSTER_NAME }}/g' {} +
     find {{ CLUSTER_PATH }} -type f -exec sed -i 's/cluster_domain: .*/cluster_domain: {{ DOMAIN_NAME }}/g' {} +
 
-    # Disable checkouting the model from remote repository
-    cat << 'EOF' > /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml
+    # Create the cfg01 inventory file or use existing
+    export CFG01_INVENTORY_FILE="/srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml"
+    [ -f ${CFG01_INVENTORY_FILE} ] || cat << 'EOF' > ${CFG01_INVENTORY_FILE}
     classes:
     - cluster.{{ CLUSTER_NAME }}.infra.config
     parameters:
@@ -307,8 +308,9 @@
 
     export GIT_SSL_NO_VERIFY=true; git clone https://gerrit.mcp.mirantis.net/salt-models/reclass-system /srv/salt/reclass/classes/system/
 
-    # Create the cfg01 node and disable checkouting the model from remote repository
-    cat << 'EOF' > /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml
+    # Create the cfg01 inventory file or use existing
+    export CFG01_INVENTORY_FILE="/srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml"
+    [ -f ${CFG01_INVENTORY_FILE} ] || cat << 'EOF' > ${CFG01_INVENTORY_FILE}
     classes:
     - system.openssh.server.team.all
     - cluster.{{ CLUSTER_NAME }}.infra.config