From 67b998eaf9109e6df1bc267f38f70886ef69452b Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 14 Mar 2014 17:51:29 -0500 Subject: [PATCH] fix for bug 3935: support nic name with space, like Local Area Network on windows --- perl-xCAT/xCAT/DBobjUtils.pm | 2 +- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 5bf27c69e..19428d0e0 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -2747,7 +2747,7 @@ sub collapsenicsattr() # e.g nicips.eth0 # do not need to handle nic attributes without the postfix .ethx, # it will be overwritten by the attributes with the postfix .ethx, - if ($nodeattr =~ /^(nic\w+)\.(\w+)$/) + if ($nodeattr =~ /^(nic\w+)\.(.*)$/) { if ($1 && $2) { diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index be5ba6726..f2531a52b 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -622,7 +622,8 @@ sub processArgs # if it has an "=" sign its an attr=val - we hope # - this will handle "attr= " - my ($attr, $value) = $a =~ /^\s*(\S+?)\s*=\s*(\S*.*)$/; + # The attribute itself might contain "space", like "nics.Local Connection Adapter 1" on windows + my ($attr, $value) = $a =~ /^\s*(.*?)\s*=\s*(\S*.*)$/; if (!defined($attr) || !defined($value)) { my $rsp; @@ -644,7 +645,7 @@ sub processArgs my $nicattrs = 0; foreach my $kattr (keys %::ATTRS) { - if ($kattr =~ /^nic\w+\.\w+$/) + if ($kattr =~ /^nic\w+\..*$/) { $nicattrs = 1; } @@ -850,7 +851,7 @@ sub processArgs foreach my $dattr (@dispattrs) { # lsdef -t node -h -i nicips.eth0 - if($dattr =~ /^(nic\w+)\.\w+$/) + if($dattr =~ /^(nic\w+)\..*$/) { $dattr = $1; } @@ -1148,7 +1149,7 @@ sub processArgs my $i = 0; for ($i=0; $i < (scalar @::AttrList) ; $i++ ) { - if($::AttrList[$i] =~ /^(nic\w+)\.(\w+)$/) + if($::AttrList[$i] =~ /^(nic\w+)\.(.*)$/) { $::AttrList[$i] = $1; push @{$::NicsAttrHash{$::AttrList[$i]}}, $2; @@ -1306,7 +1307,7 @@ sub defmk { my $attrorig = $attr; # nicips.eth0 => nicips - if ($attr =~ /^(nic\w+)\.\w+$/) + if ($attr =~ /^(nic\w+)\..*$/) { $attr = $1; } @@ -1950,7 +1951,7 @@ sub defch { my $attrorig = $attr; # nicips.eth0 => nicips - if ($attr =~ /^(nic\w+)\.\w+$/) + if ($attr =~ /^(nic\w+)\..*$/) { $attr = $1; } @@ -2638,7 +2639,7 @@ sub setFINALattrs my %tmphash = (); foreach my $nodeattr (keys %{$::CLIATTRS{$objname}}) { - if ($nodeattr =~ /^(nic\w+)\.\w+$/) + if ($nodeattr =~ /^(nic\w+)\..*$/) { my $tmpnicattr = $1; if (!defined($tmphash{$tmpnicattr}))