Small fixes to ownership, test mode. 01/3001/1
authorAric Gardner <agardner@linuxfoundation.org>
Tue, 3 Nov 2015 15:43:22 +0000 (10:43 -0500)
committerAric Gardner <agardner@linuxfoundation.org>
Tue, 3 Nov 2015 15:44:55 +0000 (10:44 -0500)
Make sure that java connection runs in foregrond if script is run in test mode
Make sure slave.jar is owned by jenkinsuser so that it can be updated

Change-Id: I919eaf841569f1540f2a3f026f4a87064bda1b45
Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
utils/jenkins-jnlp-connect.sh

index d048859..03e47b8 100755 (executable)
@@ -100,6 +100,7 @@ fi
 
 if [[ $started_monit == "true" ]]; then
 wget --timestamping https://build.opnfv.org/ci/jnlpJars/slave.jar && true
+chown $jenkinsuser $jenkinsuser slave.jar
 
 if [[ -f /var/run/$jenkinsuser/jenkins_jnlp_pid ]];
 then echo "pid file found"
@@ -113,9 +114,12 @@ then echo "pid file found"
         fi
 fi
 
-exec $connectionstring &
-echo $! > /var/run/$jenkinsuser/jenkins_jnlp_pid
-#trap 'rm -f "$pidfile"; exit' EXIT SIGQUIT SIGINT SIGSTOP SIGTERM
+if [[ run_in_foreground == true ]]; then
+  $connectionstring
+else
+  exec $connectionstring &
+  echo $! > /var/run/$jenkinsuser/jenkins_jnlp_pid
+fi
 
 else
   echo "you are ready to start monit"
@@ -165,7 +169,8 @@ do
                 s ) slave_secret="$OPTARG";;
                 h ) usage; exit;;
                 t ) started_monit=true
-                    skip_monit=true ;;
+                    skip_monit=true 
+                    run_in_foreground=true ;;
                 f ) test_firewall ;;
                 \? ) echo "Unknown option: -$OPTARG" >&2; exit 1;;
         esac