From 93bcbc5e7147500c69ba5367a90446cbb9723d1d Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 6 Mar 2013 17:48:53 +0000 Subject: [PATCH] add sudo dcp -F support SF 3403 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15402 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DSHCLI.pm | 5 +++-- perl-xCAT/xCAT/RSYNC.pm | 14 +++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index b94294c07..4c0d2e609 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -839,6 +839,7 @@ sub fork_fanout_dcp $rcp_config{'preserve'} = $$options{'preserve'}; $rcp_config{'recursive'} = $$options{'recursive'}; + $rcp_config{'sudo'} = $$options{'sudo'}; if ($$options{'pull'}) { @@ -4598,8 +4599,8 @@ sub parse_and_run_dcp close FILE; # now put the original syncfile on the queue to sync to the SN's $rc = - &parse_rsync_input_file_on_MN(\@nodelist, \%options, $tmpsyncfile, - $::SYNCSN, $synfiledir,$nodesyncfiledir); + &parse_rsync_input_file_on_MN(\@nodelist, \%options,$tmpsyncfile, + $::SYNCSN, $synfiledir,$nodesyncfiledir); # cleanup my $cmd = "rm $tmpsyncfile"; my @output = xCAT::Utils->runcmd($cmd, 0); diff --git a/perl-xCAT/xCAT/RSYNC.pm b/perl-xCAT/xCAT/RSYNC.pm index 4039a434b..b3779c03e 100644 --- a/perl-xCAT/xCAT/RSYNC.pm +++ b/perl-xCAT/xCAT/RSYNC.pm @@ -98,13 +98,21 @@ sub remote_copy_command { if (-e ("/usr/bin/rsync")) { if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local + if ($$config{'sudo'}){ + $sync_opt = '--rsync-path=sudo /usr/bin/rsync '; + } else { $sync_opt = '--rsync-path /usr/bin/rsync '; + } } else { $sync_opt = '--rsh /bin/rsh --rsync-path /usr/bin/rsync '; } } else { if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local - $sync_opt = '--rsync-path /usr/local/bin/rsync '; + if ($$config{'sudo'}){ + $sync_opt = '--rsync-path=sudo /usr/local/bin/rsync '; + } else { + $sync_opt = '--rsync-path=/usr/local/bin/rsync '; + } } else { $sync_opt = '--rsh /bin/rsh --rsync-path /usr/local/bin/rsync '; } @@ -112,7 +120,11 @@ sub remote_copy_command } else #linux { + if ($$config{'sudo'}) { + $sync_opt = '--rsync-path=\'sudo /usr/bin/rsync\' '; + } else { $sync_opt = '--rsync-path /usr/bin/rsync '; + } } # if only syncing the service node or # (no postscripts and no append lines) then do not