From a920f94804a2d384c3266e289b482d3f84b48747 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Mon, 18 Dec 2017 11:54:30 -0800 Subject: [PATCH] check if the include line is already there before adding it to the file --- xCAT-server/lib/xcat/plugins/ddns.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100755 => 100644 xCAT-server/lib/xcat/plugins/ddns.pm diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm old mode 100755 new mode 100644 index 9fb754983..094edc9c0 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -1287,10 +1287,13 @@ sub update_namedconf { my @includes = split /[ ,]/, $site_entry; foreach (@includes) { if (defined($_)) { - push @newnamed, "include \"$_\";\n"; + my $line = "include \"$_\";\n"; + unless (grep{/$line/} @newnamed) { + push @newnamed, "include \"$_\";\n"; + } } - } push @newnamed, "\n"; + } } unless ($slave) {