userability improvement on updatenode command

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2483 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-11-09 03:20:21 +00:00
parent 2aeb8737cd
commit 5bc56a4cc6
3 changed files with 31 additions and 7 deletions

View File

@ -236,16 +236,25 @@ sub updatenode {
#print "postscripts=$postscripts, nodestring=$nodestring\n";
if ($nodestring) {
my $output;
my $cmd;
if (xCAT::Utils->isLinux()) {
$output=`XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -e /install/postscripts/xcatdsklspost 1 $postscripts 2>&1`;
$cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcatdsklspost 1 $postscripts 2>&1";
}
else {
$output=`XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -e /install/postscripts/xcataixpost 1 $postscripts 2>&1`;
$cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcataixpost 1 $postscripts 2>&1";
}
if (! open (CMD, "$cmd |")) {
my $rsp={};
$rsp->{data}->[0]= "Cannot run command $cmd";
$callback->($rsp);
} else {
while (<CMD>) {
my $rsp={};
$rsp->{data}->[0]= "$_";
$callback->($rsp);
}
close(CMD);
}
my $rsp={};
$rsp->{data}->[0]= "$output\n";
$callback->($rsp);
}
return 0;

View File

@ -64,8 +64,16 @@ open(XCATINFO,">",$xcatinfo);
print XCATINFO "XCATSERVER=$servnode\n";
close(XCATINFO);
# get the contents of the /install/postscripts dir on the server
my $rcpcmd = "rcp -r $servnode:/install/postscripts/* /xcatpost";
my $rcpcmd;
if ((@ARGV==0) || ($ARGV[0] != 2)) {
$rcpcmd= "rcp -r $servnode:/install/postscripts/* /xcatpost";
} else {
#when argv[1]=2, there is only one postscript file, user wants only download it to save time
$rcpcmd= "rcp $servnode:/install/postscripts/$ARGV[1] /xcatpost";
}
if (&runcmd($rcpcmd) != 0) {
print "$::sdate xcataixpost: Could not rcp file from $servnode.\n";
print $::LOG_FILE "$::sdate xcataixpost: Could not rcp file from $servnode.\n";
@ -125,6 +133,9 @@ if (@ARGV<1) {
print "$::sdate xcataixpost: Failed to update the xCAT server.\n";
print $::LOG_FILE "$::sdate xcataixpost: Failed to update the xCAT server..\n";
}
} else {
#called by updatenode, infrom user it is done
print "returned";
}

View File

@ -96,6 +96,10 @@ rm -f /tmp/mypostscript
killall stunnel
rm -rf /etc/stunnel
#tell user it is done when this is called by updatenode command
if [ $# -gt 0 ]; then
echo "returned"
fi