diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 8fc9801f6..7b9b4e972 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1392,7 +1392,7 @@ sub addkitcomp ($osdistrotable) = $tabs{osdistro}->getAttribs({osdistroname=> $osimagetable->{'osdistroname'}}, 'basename', 'majorversion', 'minorversion', 'arch', 'type'); if ( !$osdistrotable or !$osdistrotable->{basename} ) { my %rsp; - push@{ $rsp{data} }, "$osdistroname osdistro does not exist"; + push @{ $rsp{data} }, "$osdistroname osdistro does not exist"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; } @@ -1407,13 +1407,34 @@ sub addkitcomp # Read serverrole from osimage. $os{$osimage}{serverrole} = lc($osimagetable->{'serverrole'}); - } else { + } elsif ( !$osimagetable or !$osimagetable->{'osname'} ) { my %rsp; - push@{ $rsp{data} }, "$osimage osimage does not exist or not saticified"; + push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osname' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; + + } elsif ( !$osimagetable->{'osvers'} ) { + my %rsp; + push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osvers' attribute"; + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + return 1; + } elsif ( !$osimagetable->{'osarch'} ) { + my %rsp; + push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osarch' attribute"; + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + return 1; + } else { + $os{$osimage}{type} = lc($osimagetable->{'osname'}); + $os{$osimage}{arch} = lc($osimagetable->{'osarch'}); + $os{$osimage}{serverrole} = lc($osimagetable->{'serverrole'}); + + my ($basename, $majorversion, $minorversion) = $osimagetable->{'osvers'} =~ /^(\D+)(\d+)\W+(\d+)/; + $os{$osimage}{basename} = lc($basename); + $os{$osimage}{majorversion} = lc($majorversion); + $os{$osimage}{minorversion} = lc($minorversion); } + foreach my $kitcomp ( keys %kitcomps ) { (my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $kitcomp}, 'kitname', 'kitreponame', 'serverroles', 'kitcompdeps'); if ( $kitcomptable and $kitcomptable->{'kitname'} and $kitcomptable->{'kitreponame'}) {