From 33b98d0d9ef1964a85ae3aa0ecd74b874f980281 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 10 Jul 2008 12:16:52 +0000 Subject: move code into run_urpm_command() --- urpm/parallel_ka_run.pm | 7 ++++++- urpm/parallel_ssh.pm | 13 +++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'urpm') diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm index 4352cd00..420921f2 100644 --- a/urpm/parallel_ka_run.pm +++ b/urpm/parallel_ka_run.pm @@ -54,6 +54,11 @@ sub urpm_popen { close $fh or $urpm->{fatal}(1, N("rshp failed, maybe a node is unreacheable")); } +sub run_urpm_command { + my ($parallel, $urpm, $cmd, $para) = @_; + system(_rshp_urpm($parallel, $urpm, '', $cmd, $para)) == 0; +} + sub copy_to_dir { &_run_mput } sub propagate_file { @@ -99,7 +104,7 @@ sub parallel_install { } else { my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : ""); #- continue installation. - system(_rshp_urpm($parallel, $urpm, '', 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line")) == 0; + run_urpm_command($parallel, $urpm, 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line"); } } diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm index 23819374..e70ff41e 100644 --- a/urpm/parallel_ssh.pm +++ b/urpm/parallel_ssh.pm @@ -81,6 +81,14 @@ sub urpm_popen { } } +sub run_urpm_command { + my ($parallel, $urpm, $cmd, $para) = @_; + + foreach my $node (keys %{$parallel->{nodes}}) { + system(_ssh_urpm($urpm, $node, $cmd, $para)); + } +} + #- parallel install. sub parallel_install { my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_; @@ -110,10 +118,7 @@ sub parallel_install { } else { my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : ""); #- continue installation on each node - foreach my $node (keys %{$parallel->{nodes}}) { - my $command = _ssh_urpm($urpm, $node, 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line"); - system($command); - } + run_urpm_command($parallel, $urpm, 'urpmi', "--no-verify-rpm --auto --synthesis $parallel->{synthesis} $line"); } } -- cgit v1.2.1