From 47d86fe4b6d351af5c7bb41837f645da276254e7 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 21 Jan 2011 23:34:11 +0000 Subject: [PATCH] -Prevent empty subnet declarations git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8727 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/dhcp.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 47a7ab905..850af9edf 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1720,9 +1720,19 @@ sub writeout { my $targ; open($targ, '>', $dhcpconffile); - foreach (@dhcpconf) + my $idx; + my $skipone; + foreach $idx (0..$#dhcpconf) { - print $targ $_; + #avoid writing out empty shared network declarations + if ($dhcpconf[$idx] =~ /^shared-network/ and $dhcpconf[$idx+1] =~ /^} .* nic_end/) { + $skipone=1; + next; + } elsif ($skipone) { + $skipone=0; + next; + } + print $targ $dhcpconf[$idx]; } close($targ); if (@dhcp6conf) {