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 03e72f1..d65d0e4 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"
@@ -121,6 +111,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