From 3176fb6a27a98d702ef2c4908f4be635733abdd9 Mon Sep 17 00:00:00 2001 From: billwajda Date: Wed, 9 Jan 2013 20:25:08 +0000 Subject: [PATCH] check for either ! or : for delimeter in confignics and configeth git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14836 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/configeth | 14 ++++++++++++-- xCAT/postscripts/confignics | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 41a10d970..bc3ff3e14 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -60,7 +60,12 @@ while ( $cnt <= $net_cnt ) { # eth0:1_0_0_0-255_255_0_0|network2,eth1:1_1_0_0 # create array of networks for this nic foreach my $nic_networks (split(/,/,$nicnetworks)) { - my @net = split(/!/,$nic_networks); + my @net = (); + if ( $nic_networks =~ /!/ ) { + @net = split(/!/,$nic_networks); + } else { + @net = split(/:/,$nic_networks); + } if ($net[0] eq $nic) { @nic_nets = split(/\|/,$net[1]); last; @@ -70,7 +75,12 @@ foreach my $nic_networks (split(/,/,$nicnetworks)) { # get all nic ipaddress from $nicips: i.e. eth0:1.0.0.1|2.0.0.1,eth1:1.1.1.1 # Then get all ips for this specific nic, i.e. eth0. foreach my $ips (split(/,/,$nicips)) { - my @ip = split(/!/,$ips); + my @ip = (); + if ( $ips =~ /!/ ) { + @ip = split(/!/,$ips); + } else { + @ip = split(/:/,$ips); + } if ($ip[0] eq $nic ) { @nic_ips = split(/\|/,$ip[1]); } diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index df1a246ce..ff088ff7b 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -18,7 +18,7 @@ my $nicips = $ENV{NICIPS}; my $niccustomscripts = $ENV{NICCUSTOMSCRIPTS}; my $nictypes = $ENV{NICTYPES}; my $xcatpostdir = "/xcatpost"; -my %cust_script_nics = (); +my %cust_script_nics = (); # hash to save nics specified in niccustomscripts system("logger -t xcat -p local4.info 'confignics: CUSTOMSCRIPTS: $niccustomscripts '"); # niccustomscripts specifies which NICS need to be configured. @@ -33,7 +33,12 @@ if ( defined $niccustomscripts && length $niccustomscripts > 0 ) { foreach my $customscript (split(/,/,$niccustomscripts)) { - my @script = split(/!/,$customscript); + my @script = (); + if ( $customscript =~ /!/ ) { + @script = split(/!/,$customscript); + } else { + @script = split(/:/,$customscript); + } $cust_script_nics{$script[0]} = 1; runcmd("$xcatpostdir/$script[1]"); system("logger -t xcat -p local4.info 'confignics: executed custom script: $script[1] '"); @@ -43,7 +48,12 @@ if ( defined $niccustomscripts && length $niccustomscripts > 0 ) { # first determine nic from nicips and get the nictype. Invoke configeth or configiba based on nictype. # i.e. $nictypes = "eth1:ethernet,eth2:ethernet" foreach my $nic_type (split(/,/,$nictypes)) { - my @nic_and_type = split(/!/,$nic_type); + my @nic_and_type = (); + if ( $nic_type =~ /!/ ) { + @nic_and_type = split(/!/,$nic_type); + } else { + @nic_and_type = split(/:/,$nic_type); + } if ("ETHERNET" eq uc($nic_and_type[1])) { runcmd("$xcatpostdir/configeth $nic_and_type[0]"); system("logger -t xcat -p local4.info 'confignics: executed script: configeth $nic_and_type[0] '");