fix path to input file during cat to log
[yaml_builds.git] / tools / generate_yamls.sh
old mode 100644 (file)
new mode 100755 (executable)
index 4528442..f49ddd5
@@ -1,6 +1,6 @@
 #!/bin/bash
 ##############################################################################
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.          #
+# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.        #
 #                                                                            #
 # Licensed under the Apache License, Version 2.0 (the "License"); you may    #
 # not use this file except in compliance with the License.                   #
 # limitations under the License.                                             #
 ##############################################################################
 
+set -x
 
 source $(dirname $0)/setenv.sh
 
-if [ -z "$AIC_CLCP_MANIFESTS" ]
-then
-  echo "Please follow https://codecloud.web.att.com/projects/ST_CCP/repos/aic-clcp-manifests/browse/docs/source/deployment_blueprint.md to clone aic-clcp-manifests. Also export AIC_CLCP_MANIFESTS to it."
-  exit -1
-fi
-
-if [ -z "$AIC_CLCP_SECURITY_MANIFESTS" ]
-then
-  echo "Please follow https://codecloud.web.att.com/projects/ST_CCP/repos/aic-clcp-manifests/browse/docs/source/deployment_blueprint.md to clone aic-clcp-security-manifests. Also export AIC_CLCP_SECURITY_MANIFESTS to it."
-  exit -1
-fi
-
 if [ -z "$1" ]
 then
-  echo "Plese pass site name as command line argument"
+  echo "Please pass site name as command line argument"
   exit -2
 else
   SITE=${SITE:-$1}
@@ -40,7 +29,26 @@ else
 fi
 
 cd $YAML_BUILDS
-python ./scripts/jcopy.py $SITE.yaml ./templates/aic-clcp-manifests $AIC_CLCP_MANIFESTS/site/$SITE
-python ./scripts/jcopy.py $SITE.yaml ./templates/aic-clcp-security-manifests $AIC_CLCP_SECURITY_MANIFESTS/site/$SITE
-python ./scripts/jcopy.py $SITE.yaml ./templates/yaml_builds/set_site_env.sh ./tools/
-mv ./tools/set_site_env.sh ./tools/env_$SITE.sh
+
+# ECHO INPUT FILE TO LOGS FOR TROUBLESHOOTING
+echo "#######################################"
+echo "# USING INPUT FILE [${YAML_BUILDS}\${SITE}.yaml]"
+echo "#######################################"
+sed -E 's/(^.*password:).*/\1 ###PASSWORD REMOVED####/g' ${YAML_BUILDS}\${SITE}.yaml
+echo "#######################################"
+
+python ./scripts/jcopy.py $SITE.yaml ./tools/j2/set_site_env.sh ./tools/env_$SITE.sh
+source ./tools/env_$SITE.sh
+
+if [ ! -d "$AIRSHIP_TREASUREMAP" ]; then
+  echo "ERROR: Missing AIRSHIP_TREASUREMAP directory [$AIRSHIP_TREASUREMAP]."
+  exit -1
+fi
+
+if [ ! -d "$AIRSHIP_TEMPLATES" ]; then
+  echo "ERROR: Missing AIRSHIP_TEMPLATES directory [$AIRSHIP_TEMPLATES]."
+  exit -1
+fi
+
+python ./scripts/jcopy.py $SITE.yaml $AIRSHIP_TEMPLATES $YAML_BUILDS/site/$SITE
+cp -r site/common/* site/$SITE/