From 0118e0ff31d53bcc19961d72c46786e6e46fcede Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 2 Jun 2010 09:43:30 +0000 Subject: [PATCH] fix for bug 2984196, check for site name git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6311 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 47 +++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index e7a1c74e4..803410096 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2586,19 +2586,16 @@ sub defls # Get all the objects of this type my @allobjoftype; - if ($type ne 'site') - { - @allobjoftype = xCAT::DBobjUtils->getObjectsOfType($type); + @allobjoftype = xCAT::DBobjUtils->getObjectsOfType($type); - unless (@allobjoftype) - { - my $rsp; - $rsp->{data}->[0] = - "Could not find any objects of type \'$type\'."; - xCAT::MsgUtils->message("I", $rsp, $::callback); - next; - } - } # end - if not site table + unless (@allobjoftype) + { + my $rsp; + $rsp->{data}->[0] = + "Could not find any objects of type \'$type\'."; + xCAT::MsgUtils->message("I", $rsp, $::callback); + next; + } my @attrlist; if (($type ne 'site') && ($type ne 'monitoring')) @@ -2639,23 +2636,19 @@ sub defls } } - # if anything but the site table do this - if ($type ne 'site') + # check the object names only if + # the object names are passed in through command line + if ($::objectsfrom_args || $::opt_o || (($type eq 'node') && ($::opt_o || @::noderange))) { - # check the object names only if - # the object names are passed in through command line - if ($::objectsfrom_args || $::opt_o || (($type eq 'node') && ($::opt_o || @::noderange))) + if (!grep(/^$obj$/, @allobjoftype)) { - if (!grep(/^$obj$/, @allobjoftype)) - { - my $rsp; - $rsp->{data}->[0] = - "Could not find an object named \'$obj\' of type \'$type\'."; - xCAT::MsgUtils->message("I", $rsp, $::callback); - next; - } - } - } # end - if not site table + my $rsp; + $rsp->{data}->[0] = + "Could not find an object named \'$obj\' of type \'$type\'."; + xCAT::MsgUtils->message("I", $rsp, $::callback); + next; + } + } # special handling for site table - for now !!!!!!! if (($type eq 'site') || ($type eq 'monitoring'))