Fix "ambiguous redirect" etc with use in Jenkins 03/52103/5
authorBryan Sullivan <bryan.sullivan@att.com>
Tue, 13 Feb 2018 15:18:03 +0000 (07:18 -0800)
committerBryan Sullivan <bryan.sullivan@att.com>
Tue, 13 Feb 2018 21:41:29 +0000 (13:41 -0800)
JIRA: MODELS-2

Change-Id: I4d07247b8fe535bab645475e689e46f48a6bacfa
Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
tools/cloudify/k8s-cloudify.sh
tools/kubernetes/demo_deploy.sh
tools/kubernetes/k8s-cluster.sh

index b3780ae..f922880 100644 (file)
 #.     <user>: username on the target host. Also used to indicate OS name.
 #.     clean: uninstalls cloudify CLI and Manager
 #.
-#. If using this script to start/stop blueprints with multiple k8s environments,
-#. before invoking the script copy the k8s_env.sh script from the target
-#. cluster and copy to ~/k8s_env.sh, e.g.
-#.   scp centos@sm-1:/home/centos/k8s_env.sh ~/k8s_env_sm-1.sh
-#.   cp ~/k8s_env_sm-1.sh ~/k8s_env.sh
-#.
 #. Status: this is a work in progress, under test.
 
 function fail() {
@@ -324,6 +318,7 @@ function start() {
 
   log "package the blueprint"
   # CLI: cfy blueprints package -o ~/tmp/$bp $bp
+       mkdir -p ~/tmp
   tar ckf ~/tmp/blueprint.tar $bp
 
   log "upload the blueprint"
index 75bd8f7..2a3f8f2 100644 (file)
 #.             worker, or folder (e.g. "/ceph")
 #. <extras>: optional name of script for extra setup functions as needed
 #.
-#. The script will create a k8s environment setup file specific to the master
-#. hostname, e.g. k8s_env_k8s-1.sh. This allows multiple deploys to be invoked
-#. from the same admin server, by 
-#.
 #. See tools/demo_deploy.sh in the OPNFV VES repo for additional environment
 #. variables (mandatory/optional) for VES
 
+trap 'fail' ERR
+
+function fail() {
+  exit 1
+}
+
 function run() {
   start=$((`date +%s`/60))
   $1
@@ -77,11 +79,12 @@ deploy_start=$((`date +%s`/60))
 extras=${10}
 
 if [[ "$4" != "$5" ]]; then
-  k8s_master_hostname=$(echo $1 | cut -d ' ' -f 1)
+  k8s_master_hostname=$(echo "$1" | cut -d ' ' -f 1)
 else
   k8s_master_hostname=$1
 fi
-cat <<EOF >~/k8s_env_$k8s_master_hostname.sh
+cat <<EOF >~/k8s_env.sh
+#!/bin/bash
 k8s_nodes="$1"
 k8s_user=$2
 k8s_key=$3
@@ -103,7 +106,7 @@ export k8s_pub_net
 export k8s_ceph_mode
 export k8s_ceph_dev
 EOF
-source ~/k8s_env_$k8s_master_hostname.sh
+source ~/k8s_env.sh
 env | grep k8s_
 
 echo; echo "$0 $(date): Deploying base OS for master and worker nodes..."
@@ -116,7 +119,7 @@ ssh-add $k8s_key
 scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $k8s_key \
   $k8s_user@$k8s_master:/home/$k8s_user/$k8s_key
 scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
-  ~/k8s_env_$k8s_master_hostname.sh $k8s_user@$k8s_master:/home/$k8s_user/k8s_env.sh
+  ~/k8s_env.sh $k8s_user@$k8s_master:/home/$k8s_user/k8s_env.sh
 
 echo; echo "$0 $(date): Setting up kubernetes master..."
 scp -r -o UserKnownHostsFile=/dev/null  -o StrictHostKeyChecking=no \
index fb06f5d..e9293f6 100644 (file)
@@ -261,7 +261,7 @@ EOF
     fi
     ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
       $USER@$worker bash prereqs.sh
-    scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/k8s_env_$k8s_master_hostname.sh \
+    scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ~/k8s_env.sh \
       $USER@$worker:/home/$USER/k8s_env.sh
     scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
       start_worker.sh $USER@$worker:/home/$USER/.