From 9e1008b18a911bd65409c0a74e994eae1222bcba Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 18 Jul 2017 05:30:39 -0400 Subject: [PATCH] fix issue 3490: "rscan -w" will delete ip attribute of node which was defined ahead --- perl-xCAT/xCAT/PPCdb.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index af6eebead..51967544d 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -217,14 +217,16 @@ sub add_ppc { ############################### # Update hosts table ############################### - if ($otherinterfaces) { - $db{hosts}->setNodeAttribs($name, - { otherinterfaces => $ips }); - } else { - $db{hosts}->setNodeAttribs($name, - { ip => $ips }); + if ($ips) { + if ($otherinterfaces) { + $db{hosts}->setNodeAttribs($name, + { otherinterfaces => $ips }); + } else { + $db{hosts}->setNodeAttribs($name, + { ip => $ips }); + } + $db{hosts}{commit} = 1; } - $db{hosts}{commit} = 1; ############################### # Update mac table