diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index f2d5a87d7..c1f59fdea 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -835,7 +835,7 @@ sub fork_fanout_dcp my @target_file = split '/', $$options{'source'}; $rcp_config{'dest-file'} = -"$$options{'target'}/$target_file[$#target_file]._$$target_properties{'hostname'}"; + "$$options{'target'}/$target_file[$#target_file]._$$target_properties{'hostname'}"; } @@ -850,6 +850,8 @@ sub fork_fanout_dcp $$options{'destDir_srcFile'}{$user_target}; } + $dsh_trace + && ($rcp_config{'trace'} = 1); #eval "require RemoteShell::$rsh_extension"; eval "require xCAT::$rsh_extension"; my $remoteshell = "xCAT::$rsh_extension"; diff --git a/perl-xCAT/xCAT/RSYNC.pm b/perl-xCAT/xCAT/RSYNC.pm index b40158d80..bd6d6efa3 100644 --- a/perl-xCAT/xCAT/RSYNC.pm +++ b/perl-xCAT/xCAT/RSYNC.pm @@ -156,7 +156,11 @@ sub remote_copy_command $dest_user_host = "$$config{'dest-user'}@" . "$$config{'dest-host'}"; } - print RSCYCCMDFILE "#!/bin/sh\n"; + if ($$config{'trace'}) { + print RSCYCCMDFILE "#!/bin/sh -x\n"; + } else { + print RSCYCCMDFILE "#!/bin/sh\n"; + } if ($localhost == 1) { # running to the MN from the MN print RSCYCCMDFILE "/bin/mkdir -p $dest_dir_list\n"; diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index f45d68689..c92b3d949 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -686,7 +686,6 @@ sub preprocess_updatenode } # Get the MN names - my @MNip = xCAT::NetworkUtils->determinehostname; my @MNnodeinfo = xCAT::NetworkUtils->determinehostname; my $MNnodename = pop @MNnodeinfo; # hostname my @MNnodeipaddr = @MNnodeinfo; # ipaddresses @@ -1695,6 +1694,24 @@ sub updatenodesyncfiles } } + my $dhs_from_user_env; + # get the Environment Variables and set DSH_FROM_USERID if possible (From updatenode client) + if (defined($request->{environment})) { + foreach my $envar (@{ $request->{environment} }) + { + if ($envar =~ /^DSH_FROM_USERID=/) { + $dhs_from_user_env = $envar; + last; + } + } + } + unless ($dhs_from_user_env) { + # $request->{username} is gotten from CN in client certificate + if (($request->{username}) && defined($request->{username}->[0])) { + $dhs_from_user_env = 'DSH_FROM_USERID=' . $request->{username}->[0]; + } + } + my $node_syncfile = xCAT::SvrUtils->getsynclistfile($nodes); foreach my $node (@$nodes) { @@ -1745,6 +1762,10 @@ sub updatenodesyncfiles } else { # else this is updatenode -F $env = ["DSH_RSYNC_FILE=$synclist"]; } + if ($dhs_from_user_env) { + push $env, $dhs_from_user_env; + } + push @$args, "--nodestatus"; if (defined($::fanout)) { # fanout push @$args, "-f"; @@ -1765,6 +1786,7 @@ sub updatenodesyncfiles if ($::VERBOSE) { + push @$args, "-T"; my $rsp = {}; $rsp->{data}->[0] = " $localhostname: Internal call command: xdcp $nodestring " . join(' ', @$args); diff --git a/xCAT-server/lib/xcat/plugins/xdsh.pm b/xCAT-server/lib/xcat/plugins/xdsh.pm index 3378e512a..2a2c98fd5 100644 --- a/xCAT-server/lib/xcat/plugins/xdsh.pm +++ b/xCAT-server/lib/xcat/plugins/xdsh.pm @@ -639,6 +639,7 @@ sub process_servicenodes_xdcp $addreq->{'_xcatdest'} = $::mnname; $addreq->{node} = \@sn; $addreq->{noderange} = \@sn; + $addreq->{forceroot}->[0] = 1; # check input request for --nodestatus my $args = $req->{arg}; # argument @@ -1215,6 +1216,9 @@ sub process_request $ENV{DSH_FROM_USERID} = $request->{username}->[0]; } } + if ($request->{forceroot}) { + $ENV{DSH_FROM_USERID} = 'root'; + } if ($command eq "xdsh") { xdsh($nodes, $args, $callback, $command, $request->{noderange}->[0]);