jenkins-jnlp-connect.sh: monit config file was always updated 97/11097/1
authorJosep Puigdemont <josep.puigdemont@enea.com>
Thu, 10 Mar 2016 15:39:48 +0000 (16:39 +0100)
committerJosep Puigdemont <josep.puigdemont@enea.com>
Thu, 10 Mar 2016 15:39:48 +0000 (16:39 +0100)
The jenkins-jnlp-connect.sh script will check whether a monit
configuration file for jenkins exists. If it does, it will make sure the
contents are correct according to the paramters provided in the command
line. The check is made diffing the contents of the file with what is
expected by the script. However the script compares the contents of the
file against a string that is not exactly the same to what would be
written to the file by the script, resulting in the check always
failing, and the file being rewritten unnecessarily every time.

Change-Id: I0b15195e9d667c11898942c92b39ef3fb053821d
Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
utils/jenkins-jnlp-connect.sh

index ec31a4a..10ac50b 100755 (executable)
@@ -100,8 +100,8 @@ if [[ -f $monitconfdir/jenkins ]]; then
   #test for diff
   if [[ "$(diff $monitconfdir/jenkins <(echo "\
 check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid
-start program = \"usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@'\"
-stop program = \" /bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\
+start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@'\"
+stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\
 ") )" ]]; then
     echo "Updating monit config..."
     makemonit $@