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/trunk@11929 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
daniceexi 2012-03-21 09:49:34 +00:00
parent a7b456d288
commit 9e173d19ff
2 changed files with 30 additions and 8 deletions

View File

@ -369,10 +369,21 @@ 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;
}
}

View File

@ -560,10 +560,21 @@ 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;
}
}