Add secrets_encryption_enabled

Change-Id: I953a2c8dc98e2285bed617532c306ad82eb991bb
diff --git a/jobs/pipelines/swarm-create-cfg-config-drive.groovy b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
index b2901ee..f363869 100644
--- a/jobs/pipelines/swarm-create-cfg-config-drive.groovy
+++ b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
@@ -97,16 +97,6 @@
         }
     }
 
-    stage("Prepare arguments for generation config drive") {
-
-        config_drive_script_path = "mcp-common-scripts-git/config-drive/create_config_drive.sh"
-        user_data_script_path = "mcp-common-scripts-git/config-drive/master_config.yaml"
-        sh "chmod +x ${config_drive_script_path}"
-
-        //args = "--user-data user_data --vendor-data user_data2 --hostname cfg01 --model model --mk-pipelines mk-pipelines/ --pipeline-library pipeline-library/ ${iso_name}"
-        args = "--user-data user_data2 --vendor-data ${user_data_script_path} --hostname cfg01 --model model --mk-pipelines mk-pipelines/ --pipeline-library pipeline-library/ ${iso_name}"
-    }
-
     stage("Get cluster model") {
         def model_url = "${MODEL_URL}"
         sh "rm -rf model"
@@ -120,6 +110,23 @@
         }
     }
 
+    stage("Prepare arguments for generation config drive") {
+
+        config_drive_script_path = "mcp-common-scripts-git/config-drive/create_config_drive.sh"
+        user_data_script_path = "mcp-common-scripts-git/config-drive/master_config.yaml"
+        sh "chmod +x ${config_drive_script_path}"
+
+        //args = "--user-data user_data --vendor-data user_data2 --hostname cfg01 --model model --mk-pipelines mk-pipelines/ --pipeline-library pipeline-library/ ${iso_name}"
+        args = "--user-data user_data2 --vendor-data ${user_data_script_path} --hostname cfg01 --model model --mk-pipelines mk-pipelines/ --pipeline-library pipeline-library/"
+        try {
+            sh "test -f model/encryption-key.asc"
+            args = "${args} --gpg-key model/encryption-key.asc ${iso_name}"
+
+        } catch (e) {
+            args = "${args} ${iso_name}"
+        }
+    }
+
     stage("Set data"){
         for (i in entries(smc)) {
             // Replace only if the variable is non-empty, leave default otherwise
diff --git a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/cookiecutter-context-queens-dvr-sl.yaml b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/cookiecutter-context-queens-dvr-sl.yaml
index b2f2ea5..93fec6b 100644
--- a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/cookiecutter-context-queens-dvr-sl.yaml
+++ b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/cookiecutter-context-queens-dvr-sl.yaml
@@ -279,3 +279,62 @@
   barbican_enabled: 'False'
   barbican_integration_enabled: 'False'
 
+  secrets_encryption_enabled: 'True'
+  secrets_encryption_key_id: 'F5CB2ADC36159B03'
+  secrets_encryption_private_key: |
+    -----BEGIN PGP PRIVATE KEY BLOCK-----
+
+    lQcYBFyBRcUBEACmP/muUIwbEg6Z7dA3c9I2NadcjDHXKg/ViXwaOB4KSd9/FC0o
+    KSBPccWb+1sm+zdUy2f/LC5r8RvU7yZd4Mbzz8R1DQncXg4nG7bppW7oAcHpc0jk
+    pV/SvdMYxuXsrbKbpoGEquwVkbb4oTv2MLSBfGfFzBeQfiwGEWm1xPLSeXc4biLC
+    FatCU7w4LS1U4BEOqRCp6lW/hQFLoX+j6rNT8TwC5AeFpKgUWuQZGOO4fZKpbvo2
+    sCvF5VA1HSVXlZtzum6pL1yzLL/SoyLrYOy1KrZQmSBHG9htCZQVmvYK7U5WtWE4
+    Ws5IAj+HwvgKyzXE2Srsirj1NqauQRsk+1riQk3rpDrX2BeXNUSoHR5M/RDY0gCc
+    8P6heanQRnyFtjUSoovkQsydY77+QVxe0MCs+lZlg31fL+wJVG7FIbIKKwR5sj8i
+    /JqhWE+t2ZzIrQ/7o7fRk7hv/u69Vb/t/Nt7fkbn53zoubqi3kNgXf6hwhTUtfW/
+    lE9cc4JTzis4i/RnILUDnAwos1c0Z+tGCUo4pbiP71VfU8L259g+clPFXOIkqA9t
+    L9JSZQfhH/lRj3Abs57OvZjN7/D1h8PWB+8nTB8bkoUt45SubgQb0Y9maWUcwjxw
+    AcJSIk6mq8vVdBu7zOuslDjMno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bdtz7Uy5Ah9O3WNI+ejmOpCtuc3P/XOkdttKZLuCNCs6ocgCsejpNHcFK
+    vMhOhnRKV8kcBrG2QLyfSyafBtM/zV+NR4Wrng71Za8fiXHlDanmrAIyuSnD538r
+    hTwSFe0C9HntwuF6W+UShN7c+jPJaKQjKbZy9fuFp33NcTSPCB5dH9yrhQvOeFQo
+    dFzEabMDFVGPfUVWR+TH39dWYOsq5zFmgQAbOB/vHdmEtrYNrxX0AiCZZHQHTUb9
+    oBK68V8eVeFdoRLcMORBZ2RCqkQTOQoAF7o772knltjtsymnI0XNvVC/XCnZv89Q
+    /eoivrd/rMMpTFOGcys6EAnSUWx0ZG/JCkezQqnx9U219BvqKNOZ60aOeOYHKpsX
+    Ha8Nr72YRmtm0UMsDjEUyLOj+o06XnN7uafMv2bZpjWh2hfOrkAbxe41z6t+78ho
+    P+C5vSvp01OmAt71iq+62MXVcLVKEWDpiuZSj8m83RlY5AGIaPaGX9LKPcHdGxKw
+    QSczgB/jI3G08vWaq82he6UJuYexbYe1iJXfvcx8kThwZ1nXQJm+7UsISUsh8/NZ
+    x0n/
+    =uxDD
+    -----END PGP PRIVATE KEY BLOCK-----
diff --git a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/encryption-key.asc b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/encryption-key.asc
new file mode 100644
index 0000000..381eb77
--- /dev/null
+++ b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/encryption-key.asc
@@ -0,0 +1,56 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+
+lQcYBFyBRcUBEACmP/muUIwbEg6Z7dA3c9I2NadcjDHXKg/ViXwaOB4KSd9/FC0o
+KSBPccWb+1sm+zdUy2f/LC5r8RvU7yZd4Mbzz8R1DQncXg4nG7bppW7oAcHpc0jk
+pV/SvdMYxuXsrbKbpoGEquwVkbb4oTv2MLSBfGfFzBeQfiwGEWm1xPLSeXc4biLC
+FatCU7w4LS1U4BEOqRCp6lW/hQFLoX+j6r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ied-cicd-queens-dvr-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-queens-dvr-sl.yaml
index 1bda65e..b52c210 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
@@ -14,6 +14,8 @@
 
 {{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
+{{ SHARED.MACRO_UPLOAD_AND_IMPORT_GPG_ENCRYPTION_KEY() }}
+
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
 {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index c3bc0f3..410e0d0 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -331,6 +331,37 @@
   skip_fail: false
 {%- endmacro %}
 
+{%- macro MACRO_UPLOAD_AND_IMPORT_GPG_ENCRYPTION_KEY() %}
+{%- set KEY_FILE_NAME = 'encryption-key.asc' %}
+- description: "Upload gpg encruption key"
+  upload:
+    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
+    local_filename: {{ KEY_FILE_NAME }}
+    remote_path: /root/
+  node_name: {{ HOSTNAME_CFG01 }}
+
+- description: Import encryption key
+  cmd: |
+    set -e;
+    set -x;
+    gpg --import {{ KEY_FILE_NAME }}
+    gpg --list-keys
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 1}
+  skip_fail: false
+
+- description: Put encryption key to reclass folder
+  cmd: |
+    set -e;
+    set -x;
+    mkdir -p /srv/salt/reclass
+    cp /root/{{ KEY_FILE_NAME }} /srv/salt/reclass/
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 1}
+  skip_fail: false
+
+{%- endmacro %}
+
 
 {%- macro MACRO_GENERATE_COOKIECUTTER_MODEL(IS_CONTRAIL_LAB=false, CONTROL_VLAN=None, TENANT_VLAN=None, CLUSTER_PRODUCT_MODELS='') %}
 {###################################################################}
@@ -450,11 +481,14 @@
     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 /root/cookiecutter-templates/cluster_product/)' %}
+    mkdir -p /tmp/output /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/
     for item in {{ items }}; do
+      [ "$item" = "stacklight2" ] && continue;
       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/;
+        --output-dir /tmp/output/$item/;
+      mv -v /tmp/output/$item/{{ CLUSTER_NAME }}/$item /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/;
     done
 
     export GIT_SSL_NO_VERIFY=true; git clone {{ SALT_MODELS_SYSTEM_REPOSITORY }} /srv/salt/reclass/classes/system/