Fixing bug 3339: check if the kitomponent is existing before adidng it.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15033 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2013-02-01 09:43:17 +00:00
parent 8c8319ca05
commit f23d37e410

View File

@ -1014,6 +1014,21 @@ sub addkit
return 1;
}
# Check if the kitcomponent is existing
my @kitcomps = $tabs{kitcomponent}->getAllAttribs( 'kitcompname' );
foreach my $kitcomp (@kitcomps) {
if ( $kitcomp->{kitcompname} ) {
foreach my $kitcompid (keys %kitcomphash) {
if ( $kitcomphash{$kitcompid}{kitcompname} and $kitcomphash{$kitcompid}{kitcompname} =~ /$kitcomp->{kitcompname}/ ) {
my %rsp;
push@{ $rsp{data} }, "Failed to add kitcomponent $kitcomp->{kitcompname} because it is already existing";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
}
}
}
}
my %rsp;
push@{ $rsp{data} }, "Adding Kit $kithash{kitname}";
xCAT::MsgUtils->message( "I", \%rsp, $callback );