diff --git a/xCAT-client/bin/xcatDBcmds b/xCAT-client/bin/xcatDBcmds index bdd13826f..87aba83b0 100755 --- a/xCAT-client/bin/xcatDBcmds +++ b/xCAT-client/bin/xcatDBcmds @@ -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) diff --git a/xCAT-client/bin/xcatclient b/xCAT-client/bin/xcatclient index 932ebad63..217a8fca6 100755 --- a/xCAT-client/bin/xcatclient +++ b/xCAT-client/bin/xcatclient @@ -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);