From dfb5132d84ceb608cdf9342738c69fa532b946b9 Mon Sep 17 00:00:00 2001 From: ligc Date: Sun, 24 May 2015 22:10:41 -0400 Subject: [PATCH] fix for bug 4676: add more error checks when the groups is blank when running mkdef/chdef --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index ddd4a39f0..ef07debca 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -1661,7 +1661,7 @@ sub defmk # If none of the attributes in nodelist is defined: groups,status,appstatus,primarysn,comments,disable # the nodelist table will not be updated, caused mkdef failed. # We give a restriction that the "groups" must be specified with mkdef. - if (($type eq "node") && !defined($::FINALATTRS{$obj}{groups})) + if (($type eq "node") && (!defined($::FINALATTRS{$obj}{groups}) || !$::FINALATTRS{$obj}{groups})) { my $rsp; $rsp->{data}->[0] = @@ -2048,12 +2048,18 @@ sub defch $isDefined = 1; } + if (!$isDefined && ($type eq 'node') && (!defined($::FINALATTRS{$obj}{'groups'}) || !$::FINALATTRS{$obj}{'groups'})) + { + my $rsp; + $rsp->{data}->[0] = "Attribute \'groups\' is not specified for node \'$obj\', skipping to the next node."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + next; + } + if (!$isDefined) { $newobjects{$obj} = $type; - if (! grep (/^groups$/, keys %{$::FINALATTRS{$obj}}) ) { - $::FINALATTRS{$obj}{'groups'} = "all"; - } } if (!$isDefined && $::opt_m)