From 3027db57c3c61023ed3d3d833377eca7279e96d9 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 6 Sep 2011 19:35:19 +0000 Subject: [PATCH] Repair error reporting after Ubuntu change git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10453 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/dhcp.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 8c354c143..d1f9bc41a 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1021,8 +1021,15 @@ sub process_request { #add the active nics to /etc/sysconfig/dhcpd or /etc/default/dhcp3-server(ubuntu) my $dhcpver; + my %missingfiles = ( "dhcpd"=>1, "dhcpd6"=>1, "dhcp3-server"=>1 ); foreach $dhcpver ("dhcpd","dhcpd6","dhcp3-server") { if (-e "/etc/sysconfig/$dhcpver") { + if ($dhcpver eq "dhcpd") { + delete($missingfiles{dhcpd}); + delete($missingfiles{dhcp3-server}); + } else { + delete($missingfiles{$dhcpver}); + } open DHCPD_FD, "/etc/sysconfig/$dhcpver"; my $syscfg_dhcpd = ""; my $found = 0; @@ -1058,6 +1065,8 @@ sub process_request print DBG_FD $syscfg_dhcpd; close DBG_FD; }elsif (-e "/etc/default/$dhcpver") { #ubuntu + delete($missingfiles{dhcpd}); + delete($missingfiles{dhcp3-server}); open DHCPD_FD, "/etc/default/$dhcpver"; my $syscfg_dhcpd = ""; my $found = 0; @@ -1090,11 +1099,15 @@ sub process_request print DBG_FD $syscfg_dhcpd; close DBG_FD; - } elsif ($_ eq "dhcpd" or $usingipv6) { - $callback->({error=>"The file /etc/sysconfig/$_ doesn't exist, check the dhcp server"}); -# return; } } + if ($usingipv6 and $missingfiles{dhcpd6}) { + $callback->({error=>"The file /etc/sysconfig/dhcpd6 doesn't exist, check the dhcp server"}); + } + if ($missingfiles{dhcpd}) { + $callback->({error=>"The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"}); + } + } unless ($dhcpconf[0])