[Pkg-nagios-changes] [SCM] Debian packaging for lconf branch, master, updated. 55c830d5bfe0d8efe96193f2b447fb06da82ac93

jmosshammer jannis.mosshammer at netways.de
Mon Jun 20 10:11:56 UTC 2011


The following commit has been merged in the master branch:
commit d3102090027e01574f2ce8909a4362e5541e46f6
Author: jmosshammer <jannis.mosshammer at netways.de>
Date:   Mon Apr 18 12:18:49 2011 +0200

    * Added error return codes to deploy script to allow external scripts to detect errors

diff --git a/source/lconf_deploy.sh b/source/lconf_deploy.sh
index 32ba6cc..342b05f 100644
--- a/source/lconf_deploy.sh
+++ b/source/lconf_deploy.sh
@@ -4,24 +4,25 @@
 #################################################
 # config
 #################################################
-
-SATELLIT="satellit1 satellit2 satellit3"
-LCONFDIR="/etc/icinga/lconf"
-LCONFTMP="/etc/icinga/lconf.tmp"
-ICINGACONFIG=/etc/icinga/icinga.cfg
-ICINGATMPCONFIG=/etc/icinga/icinga.tmp.cfg
-ICINGAUSER=icinga
-ICINGAGROUP=icinga
-ICINGABIN=$(which icinga)
-
-
-if [ ! -x $ICINGABIN ] ; then
-  ICINGABIN=/usr/local/icinga/bin/icinga
-  if [ ! -x $ICINGABIN ] ; then
-    echo "ERROR: Could not find icinga binary to check the config!"
-    exit 2
-  fi
-fi
+SATELLITS=""
+for SH_ARG in $@; do
+	SATELLIT="$SATELLITS $SH_ARG"
+done
+# Define where your icinga binary lies
+ICINGABIN="/usr/local/icinga/bin/icinga"
+# Path of your LConf installation
+LCONFBINPATH="/usr/local/LConf"
+# Define where to export the config to
+LCONFDIR="/usr/local/icinga/etc/lconf"
+# Define where to export the temporary config to
+LCONFTMP="/usr/local/icinga/lconf.tmp"
+# Define where your icinga config lies
+ICINGACONFIG=/usr/local/icinga/etc/icinga.cfg
+# Define where your temporary created icinga config should lie
+ICINGATMPCONFIG=/usr/local/icinga/etc/icinga.tmp.cfg
+
+ICINGAUSER="icinga"
+ICINGAGROUP="icinga"
 
 RUNUSER=$(whoami)
 SUDOCOMMAND=""
@@ -46,30 +47,46 @@ echo cfg_dir=$LCONFTMP >> $ICINGATMPCONFIG
 
 echo export config from LDAP
 # export original full config from LDAP
-(cd /usr/local/LConf/ ; $SUDOCOMMAND ./LConfExport.pl -o $LCONFTMP)
- 
+
+(cd $LCONFBINPATH ;$SUDOCOMMAND ./LConfExport.pl -o $LCONFTMP)	
+
+if [ $? != "0" ]; then
+	exit $?	
+fi
+(cd $LCONFBINPATH 
+if [ -f ./etc/default-templates.cfg ]; then 
+	$SUDOCOMMAND cp ./etc/default-templates.cfg  $LCONFTMP 
+fi 
+)
+
  
 # first test the config within the tmp dir
 if ( $ICINGABIN -v $ICINGATMPCONFIG ) then
  
+  # copy the preliminary config in place to pass the check
+  $SUDOCOMMAND -i rsync -a --del "$LCONFTMP"/* "$LCONFDIR"
+ 
   # generate config for satellites
   # this process may alter the original config
   # (disable checks of satellite components on the master...)
   for HOST in $SATELLIT ; do
     echo deploy config on $HOST
-    (cd /usr/local/LConf/ ; \
+    (cd $LCONFBINBATH ; \
      $SUDOCOMMAND \
-     ./LConfSlaveExport.pl -H $HOST \
+     $LCONFBINPATH/LConfSlaveExport.pl -H $HOST \
      -s $LCONFTMP \
      -t $LCONFDIR -v )
   done
 
   # copy the final config in place
-  $SUDOCOMMAND -i rsync -a --del "$LCONFTMP"/ "$LCONFDIR"
+  $SUDOCOMMAND rsync -a --del "$LCONFTMP"/* "$LCONFDIR"
 
   # reload the final config on the master
   echo reload config on Master $(hostname -f)
   $SUDOCOMMAND /etc/init.d/icinga reload
-
+  exit $?
+else 
+	exit 1	
 fi
 
+

-- 
Debian packaging for lconf



More information about the Pkg-nagios-changes mailing list