From ab25897d4ee22dd4e98cb244d162f6e8a9a01733 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 29 Apr 2013 18:04:21 +0000 Subject: [PATCH] Fix problem where makedns suddenly required hosts table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16125 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hosts.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 0167aa9b4..88a830b07 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -222,9 +222,14 @@ sub add_hosts_content { { my $ref = $hostscache->{$_}->[0]; + my $nodename = $_; + my $ip = $ref->{ip}; + if (not $ip) { + $ip = xCAT::NetworkUtils->getipaddr($nodename); #attempt lookup + } my $netn; - ($domain, $netn) = &getIPdomain($ref->{ip}, $callback); + ($domain, $netn) = &getIPdomain($ip, $callback); if (!$domain) { if ($::sitedomain) { $domain=$::sitedomain; @@ -232,7 +237,7 @@ sub add_hosts_content { $domain=$::XCATSITEVALS{domain}; } else { my $rsp; - push @{$rsp->{data}}, "No domain can be determined for node \'$ref->{node}\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n"; + push @{$rsp->{data}}, "No domain can be determined for node \'$nodename\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n"; xCAT::MsgUtils->message("W", $rsp, $callback); next; @@ -241,17 +246,17 @@ sub add_hosts_content { if ($DELNODE) { - delnode $ref->{node}, $ref->{ip}, $ref->{hostnames}, $domain; + delnode $nodename, $ip, $ref->{hostnames}, $domain; } else { - if (xCAT::NetworkUtils->isIpaddr($ref->{ip})) + if (xCAT::NetworkUtils->isIpaddr($ip)) { - addnode $callback, $ref->{node}, $ref->{ip}, $ref->{hostnames}, $domain; + addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain; } if (defined($ref->{otherinterfaces})) { - addotherinterfaces $callback, $ref->{node}, $ref->{otherinterfaces}, $domain; + addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain; } } } #end foreach