-Have 'getAllNodeAttribs' honor nodecol
-Have MacMap use getAllNodeAttribs to allow for noderange described switches/inheritence -Fix getbmcconfig to use a suffix that will pass complexity rules -Fix getbmcconfig to pass through bmcport even if genpasswords is in use git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7437 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -138,7 +138,7 @@ sub refresh_table { | ||||
|   $self->{mactable}={}; | ||||
|   $self->{switchtab} = xCAT::Table->new('switch', -create => 1); | ||||
|   $self->{switchestab} = xCAT::Table->new('switches', -create => 1); | ||||
|   my @switchentries=$self->{switchestab}->getAllAttribs(qw(switch snmpversion username password privacy auth)); | ||||
|   my @switchentries=$self->{switchestab}->getAllNodeAttribs([qw(switch snmpversion username password privacy auth)]); | ||||
|   $self->{switchparmhash}={}; | ||||
|   my $community = "public"; | ||||
|   $self->{sitetab} = xCAT::Table->new('site'); | ||||
|   | ||||
| @@ -2811,19 +2811,23 @@ sub getAllNodeAttribs | ||||
|     my %donenodes | ||||
|       ; #Remember those that have been done once to not return same node multiple times | ||||
|     my $query; | ||||
|     my $nodekey = "node"; | ||||
|     if (defined $xCAT::Schema::tabspec{$self->{tabname}}->{nodecol}) { | ||||
|         $nodekey = $xCAT::Schema::tabspec{$self->{tabname}}->{nodecol} | ||||
|     }; | ||||
|     if ($xcatcfg =~ /^mysql:/) {  #for mysql | ||||
|          $query = $self->{dbh}->prepare('SELECT node FROM ' | ||||
|          $query = $self->{dbh}->prepare('SELECT '.$nodekey.' FROM ' | ||||
|              . $self->{tabname} | ||||
|         . " WHERE " . q(`disable`) . " is NULL or " .  q(`disable`) . " in ('0','no','NO','No','nO')"); | ||||
|       } else {    | ||||
|           if ($xcatcfg =~ /^DB2:/) {  #for DB2 | ||||
|             my $qstring = "Select \"node\" FROM "; | ||||
|             my $qstring = "Select \"$nodekey\" FROM "; | ||||
|             $qstring  .= $self->{tabname}; | ||||
|             $qstring  .=  " WHERE \"disable\" is NULL OR \"disable\" LIKE '0' OR \"disable\" LIKE 'no' OR  \"disable\" LIKE 'NO' OR  \"disable\" LIKE 'No' OR  \"disable\" LIKE 'nO'"; | ||||
|             $query =  $self->{dbh}->prepare($qstring);  | ||||
|           } else {  # for other dbs  | ||||
|              $query = | ||||
|              $self->{dbh}->prepare('SELECT node FROM ' | ||||
|              $self->{dbh}->prepare('SELECT '.$nodekey.' FROM ' | ||||
|               . $self->{tabname} | ||||
|               . " WHERE \"disable\" is NULL or \"disable\" in ('','0','no','NO','no')"); | ||||
|           } | ||||
| @@ -2841,11 +2845,14 @@ sub getAllNodeAttribs | ||||
|     while (my $data = $query->fetchrow_hashref()) | ||||
|     { | ||||
|  | ||||
|         unless ($data->{node} =~ /^$/ || !defined($data->{node})) | ||||
|         unless ($data->{$nodekey} =~ /^$/ || !defined($data->{$nodekey})) | ||||
|         {    #ignore records without node attrib, not possible? | ||||
|             my @nodes = | ||||
|               xCAT::NodeRange::noderange($data->{node}) | ||||
|               xCAT::NodeRange::noderange($data->{$nodekey}) | ||||
|               ;    #expand node entry, to make groups expand | ||||
|             unless (@nodes) { #in the event of an entry not in nodelist, use entry value verbatim | ||||
|                 @nodes = ($data->{$nodekey}); | ||||
|             } | ||||
|             #my $localhash = $self->getNodesAttribs(\@nodes,$attribq); #NOTE:  This is stupid, rebuilds the cache for every entry, FIXME | ||||
|             foreach (@nodes) | ||||
|             { | ||||
| @@ -2866,7 +2873,7 @@ sub getAllNodeAttribs | ||||
|                  #populate node attribute by default, this sort of expansion essentially requires it. | ||||
|                 #$attrs->{node} = $_; | ||||
| 		foreach my $att (@attrs) { | ||||
| 			$att->{node} = $_; | ||||
| 			$att->{$nodekey} = $_; | ||||
| 		} | ||||
|                 $donenodes{$_} = 1; | ||||
|  | ||||
|   | ||||
| @@ -107,9 +107,9 @@ sub process_request  { | ||||
|   } | ||||
|   $tmphash=($sitetable->getAttribs({key=>'genpasswords'},'value'))[0]; | ||||
|   if ($tmphash->{value} eq "1" or $tmphash->{value}  =~ /y(es)?/i) { | ||||
|     $password = genpassword(8); | ||||
|     $password = genpassword(8)."1c"; | ||||
|     $gennedpassword=1; | ||||
|     $tmphash=$ipmitable->getNodeAttribs($node,['bmc','username']); | ||||
|     $tmphash=$ipmitable->getNodeAttribs($node,['bmc','username','bmcport']); | ||||
|   } else { | ||||
|     $tmphash=$ipmitable->getNodeAttribs($node,['bmc','username','bmcport','password']); | ||||
|     if ($tmphash->{password}) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user