From 4b89e1b45fe1427a118a36b59df932504eddeb53 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 31 Oct 2014 13:47:34 +0100 Subject: [PATCH] Fix error message in migrate-hosts fixes #7528 --- tools/migrate-hosts.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/migrate-hosts.cmake b/tools/migrate-hosts.cmake index ef5a97a26..abe29253d 100644 --- a/tools/migrate-hosts.cmake +++ b/tools/migrate-hosts.cmake @@ -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