relative path support for noderange
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4991 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
4d34ccd1c1
commit
219f6cfaf8
xCAT-client/bin
@ -6,6 +6,7 @@ BEGIN
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Client;
|
||||
@ -50,6 +51,7 @@ else
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$cmdref->{cwd}->[0] = cwd();
|
||||
# get info from files piped in as stdin
|
||||
if (-p STDIN) {
|
||||
my $data;
|
||||
@ -58,6 +60,32 @@ if (-p STDIN) {
|
||||
}
|
||||
$cmdref->{stdin}->[0]=$data;
|
||||
}
|
||||
# The noderange can be specified through a noderange file
|
||||
# the noderange file can be a relative path,
|
||||
# convert the relative path to a full path.
|
||||
my @tmpargv = ();
|
||||
my @tmpv = @ARGV;
|
||||
foreach my $a (@tmpv)
|
||||
{
|
||||
if (!($a =~ /=/) && !($a =~ /^-/)) {
|
||||
my @tempnr = ();
|
||||
foreach my $nr (split(/,/, $a)) {
|
||||
if ($nr =~ /^\^(.*)$/) {
|
||||
my $nrf = $1;
|
||||
if ($nrf !~ /^\//) { #relative path
|
||||
$nrf = Cwd::abs_path($nrf);
|
||||
}
|
||||
$nrf = "\^" . $nrf;
|
||||
push @tempnr, $nrf;
|
||||
} else {
|
||||
push @tempnr, $nr;
|
||||
}
|
||||
}
|
||||
$a = join(',',@tempnr);
|
||||
}
|
||||
push @tmpargv, $a;
|
||||
}
|
||||
@ARGV = @tmpargv;
|
||||
|
||||
# add all the cmd line args to the hash - to pass to the plugin subroutine
|
||||
foreach my $a (@ARGV)
|
||||
|
@ -36,6 +36,27 @@ while ($arg =~ /^-/) {
|
||||
$arg=shift(@ARGV);
|
||||
}
|
||||
if ($arg ne "NO_NODE_RANGE") {
|
||||
# The noderange can be specified through a noderange file,
|
||||
# the noderange file can be a relative path,
|
||||
# convert the relative path to a full path.
|
||||
# an ideal way is converting the relative path in xCAT::Noderange::noderange,
|
||||
# but the existing xCAT::Noderange::noderange can not get the cwd(),
|
||||
# needs to change all the callers to pass the cwd(),
|
||||
# there are more than 100 callers.
|
||||
my @tempnr = ();
|
||||
foreach my $nr (split(/,/, $arg)) {
|
||||
if ($nr =~ /^\^(.*)$/) {
|
||||
my $nrf = $1;
|
||||
if ($nrf !~ /^\//) { #relative path
|
||||
$nrf = Cwd::abs_path($nrf);
|
||||
}
|
||||
$nrf = "\^" . $nrf;
|
||||
push @tempnr, $nrf;
|
||||
} else {
|
||||
push @tempnr, $nr;
|
||||
}
|
||||
}
|
||||
$arg = join(',',@tempnr);
|
||||
$cmdref->{noderange}->[0]=$arg;
|
||||
}
|
||||
push (@{$cmdref->{arg}}, @ARGV);
|
||||
|
Loading…
x
Reference in New Issue
Block a user