Output error message and show help info if the default profile has not been activated when running getmacs
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4156 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
ef87653b36
commit
2defade7c8
@ -341,6 +341,7 @@ sub getmacs {
|
||||
my $hwtype = @$exp[2];
|
||||
my $result;
|
||||
my $name;
|
||||
my @emptynode;
|
||||
|
||||
if ( $par =~ /^HASH/ ) {
|
||||
#########################################
|
||||
@ -432,11 +433,20 @@ sub getmacs {
|
||||
my $d = $hash->{$_};
|
||||
my $mtms = @$d[2];
|
||||
my $id = @$d[0];
|
||||
my $nodetype = @$d[4];
|
||||
|
||||
my $mac_count = $nodeatt{$mtms}{$id}{'num'};
|
||||
my $value = ();
|
||||
my $data = ();
|
||||
my $type;
|
||||
|
||||
#########################################
|
||||
# Invalid target hardware
|
||||
#########################################
|
||||
if ( $nodetype ne "lpar" ) {
|
||||
return( [[$node,"Node must be LPAR",RC_ERROR]] );
|
||||
}
|
||||
|
||||
#########################################
|
||||
# Put all the attributes required
|
||||
# together
|
||||
@ -498,6 +508,26 @@ sub getmacs {
|
||||
writemac( $node, $value );
|
||||
}
|
||||
|
||||
|
||||
if ( scalar(@$value) < 2 ) {
|
||||
my $filter = "lpar_id,curr_profile";
|
||||
my $prof = xCAT::PPCcli::lssyscfg( $exp, "node", $mtms, $filter, $id );
|
||||
my $Rc = shift(@$prof);
|
||||
|
||||
#########################################
|
||||
# Return error
|
||||
#########################################
|
||||
if ( $Rc != SUCCESS ) {
|
||||
return( [[$node,@$prof[0],$Rc]] );
|
||||
}
|
||||
|
||||
foreach my $val ( @$prof ) {
|
||||
my ($lpar_id,$curr_profile) = split /,/, $val;
|
||||
if ( !length($curr_profile) || ($curr_profile =~ /^none$/) ) {
|
||||
push @emptynode,$node;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ( @$value ) {
|
||||
if ( /^#\s?Type/ ) {
|
||||
$data.= "\n$_\n";
|
||||
@ -509,6 +539,9 @@ sub getmacs {
|
||||
push @$result,[$node,$data,0];
|
||||
}
|
||||
}
|
||||
if ( scalar(@emptynode) > 0 ) {
|
||||
return([[join(",", @emptynode),"\nThese nodes have no active profiles. Please active the nodes to enable the default profiles",RC_ERROR]]);
|
||||
}
|
||||
return([@$result]);
|
||||
} else {
|
||||
#########################################
|
||||
|
Loading…
Reference in New Issue
Block a user