]> granicus.if.org Git - icinga2/commitdiff
Fix error message in migrate-hosts
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 31 Oct 2014 12:47:34 +0000 (13:47 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 31 Oct 2014 12:47:34 +0000 (13:47 +0100)
fixes #7528

tools/migrate-hosts.cmake

index ef5a97a26da4cf0efdd732aa8fef3009ecdd3abf..abe29253df6933caa6f8b9a8247bc2b212eddc05 100644 (file)
@@ -20,6 +20,10 @@ host_count=0
 service_count=0
 
 for hostFile in $sysconfdir/icinga2/conf.d/hosts/*.conf; do
+    if [ ! -e $hostFile ]; then
+        continue
+    fi
+
     host_count=$(($host_count + 1))
 
     host=`basename $hostFile .conf`
@@ -44,6 +48,10 @@ for hostFile in $sysconfdir/icinga2/conf.d/hosts/*.conf; do
         if [ ! -e $sysconfdir/icinga2/repository.d/hosts/$target ]; then
             mv $sysconfdir/icinga2/conf.d/hosts/$host $sysconfdir/icinga2/repository.d/hosts/$target
             for file in $sysconfdir/icinga2/repository.d/hosts/$target/*.conf; do
+                if [ ! -e $file ]; then
+                    break
+                fi
+
                 sed "s/localhost/$target/g" $file > $file.tmp
                 mv $file.tmp $file
             done