fixing bug 3490738: for getmacs -F option, mac address now can be with or without colon, uppercase and lowcase is also supported.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@11931 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -369,14 +369,25 @@ sub getmacs { | ||||
|                     # specified | ||||
|                     ######################################### | ||||
|                     if ( defined($filter) ) { | ||||
|                         my $matched = 1; | ||||
|                         foreach ( keys %$filter ) { | ||||
|                             if ( $att{$_} ne $filter->{$_} ) { | ||||
|                                 $matched = 0; | ||||
|                         my $matched = 0; | ||||
|                         foreach my $key ( keys %$filter ) { | ||||
|                             if ( $key eq "MAC_Address" ) { | ||||
|                                 my $mac = lc($att{$key}); | ||||
|                                 my $filter_mac = lc($filter->{$key}); | ||||
|  | ||||
|                                 $mac =~ s/://g; | ||||
|                                 $filter_mac =~ s/://g; | ||||
|  | ||||
|                                 if ( grep(/$filter_mac/, $mac) ) { | ||||
|                                     $matched = 1; | ||||
|                                     last; | ||||
|                                 } | ||||
|                             } elsif ( grep(/$filter->{$key}/, $att{$key}) ) { | ||||
|                                 $matched = 1; | ||||
|                                 last; | ||||
|                             } | ||||
|                         } | ||||
|                         if ( $matched == 1 ) { | ||||
|                         if ( $matched ) { | ||||
|                             push @$value,"$att{'Type'}  $att{'Phys_Port_Loc'}  $att{'MAC_Address'}  $att{'Adapter'}  $att{'Port_Group'}  $att{'Phys_Port'}  $att{'Logical_Port'}  $att{'VLan'}  $att{'VSwitch'}  $att{'Curr_Conn_Speed'}\n"; | ||||
|                         } | ||||
|                     } else { | ||||
|   | ||||
| @@ -560,14 +560,25 @@ sub getmacs { | ||||
|                     # specified | ||||
|                     ######################################### | ||||
|                     if ( defined($filter) ) { | ||||
|                         my $matched = 1; | ||||
|                         foreach ( keys %$filter ) { | ||||
|                             if ( $att{$_} ne $filter->{$_} ) { | ||||
|                                 $matched = 0; | ||||
|                         my $matched = 0; | ||||
|                         foreach my $key ( keys %$filter ) { | ||||
|                             if ( $key eq "MAC_Address" ) { | ||||
|                                 my $mac = lc($att{$key}); | ||||
|                                 my $filter_mac = lc($filter->{$key}); | ||||
|  | ||||
|                                 $mac =~ s/://g; | ||||
|                                 $filter_mac =~ s/://g; | ||||
|  | ||||
|                                 if ( grep(/$filter_mac/, $mac) ) { | ||||
|                                     $matched = 1; | ||||
|                                     last; | ||||
|                                 } | ||||
|                             } elsif ( grep(/$filter->{$key}/, $att{$key}) ) { | ||||
|                                 $matched = 1; | ||||
|                                 last; | ||||
|                             } | ||||
|                         } | ||||
|                         if ( $matched == 1 ) { | ||||
|                         if ( $matched ) { | ||||
|                             push @$value,"$att{'Type'}  $att{'Phys_Port_Loc'}  $att{'MAC_Address'}  $att{'Adapter'}  $att{'Port_Group'}  $att{'Phys_Port'}  $att{'Logical_Port'}  $att{'VLan'}  $att{'VSwitch'}  $att{'Curr_Conn_Speed'}"; | ||||
|                         } | ||||
|                     } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user