From 530399d5986d39f7fa54566d8912d6b1715e1ca7 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 18 Dec 2018 11:00:24 -0500 Subject: [PATCH 1/3] Modified syncfile list for EXECUTEALWAYS clause --- perl-xCAT/xCAT/DSHCLI.pm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 1fd552528..267cc349b 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -6315,13 +6315,23 @@ sub run_always_rsync_postscripts # build host and all scripts to execute # EXECUTEALWAYS will only execute the syncfile in the syncfile list foreach my $key (keys %{$$options{'destDir_srcFile'}{$host}}) { - foreach my $key1 (keys %{ $$options{'destDir_srcFile'}{$host}{$key} }) { + foreach my $key1 (keys %{ $$options{'destDir_srcFile'}{$host}->{$key} }) { my $index = 0; - while (my $src_file = $$options{'destDir_srcFile'}{$host}{$key}{$key1}->[$index]) { - if ($src_file eq $tmppostfile) { - push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); - } - $index++; + my $key1_ref = $$options{'destDir_srcFile'}{$host}->{$key}->{$key1}; + if (ref $key1_ref eq 'ARRAY') { #stored as ARRAY for same_dest_name + while (my $src_file =$$options{'destDir_srcFile'}{$host}->{$key}->{$key1}->[$index] ) { + if ($src_file eq $tmppostfile) { + push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); + } + $index++; + } + } else { #stroed as hash table for diff_dest_name + my %src_hash = %{ $$options{'destDir_srcFile'}{$host}{$key}{$key1} }; + foreach my $src_file (keys %src_hash) { + if ($src_file eq $tmppostfile) { + push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); + } + } } } } @@ -6330,8 +6340,6 @@ sub run_always_rsync_postscripts # now if we have postscripts to run, run xdsh my $out; - - foreach my $ps (keys %{ $$dshparms{'postscripts'} }) { my @nodes; From 378447afb9cf76b44321afa6a9ac1b5d71eba3b6 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 2 Jan 2019 14:02:00 -0500 Subject: [PATCH 2/3] Comments from ertao --- perl-xCAT/xCAT/DSHCLI.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 267cc349b..1c9c8af23 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -110,7 +110,7 @@ sub execute_dcp if (!scalar(%resolved_targets)) { my $rsp = {}; - $rsp->{error}->[0] = "No hosts in node list 1"; + $rsp->{error}->[0] = "DCP: No hosts in node list 1"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); return ++$result; } @@ -368,7 +368,7 @@ sub execute_dsh if (!scalar(%resolved_targets)) { my $rsp = {}; - $rsp->{error}->[0] = " No hosts in node list 2"; + $rsp->{error}->[0] = " DSH: No hosts in node list 2"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); return ++$result; } @@ -6300,6 +6300,7 @@ sub run_always_rsync_postscripts my @hosts = @$hostnames; my @newoutput = (); my $dshparms; + foreach my $postsfile (@::alwayspostscripts) { my $tmppostfile = $postsfile; @@ -6319,24 +6320,23 @@ sub run_always_rsync_postscripts my $index = 0; my $key1_ref = $$options{'destDir_srcFile'}{$host}->{$key}->{$key1}; if (ref $key1_ref eq 'ARRAY') { #stored as ARRAY for same_dest_name - while (my $src_file =$$options{'destDir_srcFile'}{$host}->{$key}->{$key1}->[$index] ) { + while (my $src_file =$key1_ref->[$index] ) { if ($src_file eq $tmppostfile) { push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); } $index++; } } else { #stroed as hash table for diff_dest_name - my %src_hash = %{ $$options{'destDir_srcFile'}{$host}{$key}{$key1} }; - foreach my $src_file (keys %src_hash) { + foreach my $src_file (keys %{$key1_ref}) { if ($src_file eq $tmppostfile) { push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); } } - } - } - } - } - } + } #end else + } #end if + } #end foreach key1 + } #end foreach key + } #end foreach host # now if we have postscripts to run, run xdsh my $out; From dd8f6b840e763047251759357a4531e8a3b74c71 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 3 Jan 2019 09:04:06 -0500 Subject: [PATCH 3/3] fix indent --- perl-xCAT/xCAT/DSHCLI.pm | 43 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 1c9c8af23..4284b4ef0 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -6311,32 +6311,31 @@ sub run_always_rsync_postscripts } foreach my $host (@hosts) { - # build xdsh queue # build host and all scripts to execute # EXECUTEALWAYS will only execute the syncfile in the syncfile list foreach my $key (keys %{$$options{'destDir_srcFile'}{$host}}) { - foreach my $key1 (keys %{ $$options{'destDir_srcFile'}{$host}->{$key} }) { - my $index = 0; - my $key1_ref = $$options{'destDir_srcFile'}{$host}->{$key}->{$key1}; - if (ref $key1_ref eq 'ARRAY') { #stored as ARRAY for same_dest_name - while (my $src_file =$key1_ref->[$index] ) { - if ($src_file eq $tmppostfile) { - push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); - } - $index++; - } - } else { #stroed as hash table for diff_dest_name - foreach my $src_file (keys %{$key1_ref}) { - if ($src_file eq $tmppostfile) { - push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); - } - } - } #end else - } #end if - } #end foreach key1 - } #end foreach key - } #end foreach host + foreach my $key1 (keys %{ $$options{'destDir_srcFile'}{$host}->{$key} }) { + my $index = 0; + my $key1_ref = $$options{'destDir_srcFile'}{$host}->{$key}->{$key1}; + if (ref $key1_ref eq 'ARRAY') { #stored as ARRAY for same_dest_name + while (my $src_file =$key1_ref->[$index] ) { + if ($src_file eq $tmppostfile) { + push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); + } + $index++; + } + } else { #stroed as hash table for diff_dest_name + foreach my $src_file (keys %{$key1_ref}) { + if ($src_file eq $tmppostfile) { + push(@{ $dshparms->{'postscripts'}{$postsfile} }, $host); + } + } + } #end else + } #end foreach key1 + } #end foreach key + } #end foreach host + } #end foreach postsfile # now if we have postscripts to run, run xdsh my $out;