From 867d477510f0a5e1f279237f2e0cbce409131475 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Tue, 12 Feb 2019 03:00:40 -0500 Subject: [PATCH 1/3] fix issue xdcp EXECUTE of .post script not working as expected #5987 --- perl-xCAT/xCAT/DSHCLI.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 1fd552528..9a3e00572 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -5936,6 +5936,11 @@ sub run_rsync_postscripts # return from rsync is tmp/file1 not /tmp/file1 substr($tmppostfile, 0, 1) = ""; + # now remove .post from the postscript file for the compare + # with the returned file name + my($tp,$post) = split(/\.post/,$tmppostfile); + $tmppostfile = $tp; + foreach my $line (@rsync_output) { my ($hostname, $ps) = split(/: /, $line); chomp $ps; @@ -5948,7 +5953,11 @@ sub run_rsync_postscripts } next; } - if ($tmppostfile eq $ps) { + + #the $postsfile .post will be run if: + # the is updated, or + # the .post file is updated + if ($ps eq $tmppostfile or $ps eq $tmppostfile.".post" ) { # build xdsh queue # build host and all scripts to execute From 2f2b17f85e8c402221ee9cf7a599bb54300c96f8 Mon Sep 17 00:00:00 2001 From: yangsong Date: Wed, 20 Feb 2019 17:45:58 +0800 Subject: [PATCH 2/3] EXECUTE in sync list will not invoke post sync scripts if the script itself is updated (#6001) --- perl-xCAT/xCAT/DSHCLI.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 9a3e00572..e7a1cb19a 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -5956,8 +5956,7 @@ sub run_rsync_postscripts #the $postsfile .post will be run if: # the is updated, or - # the .post file is updated - if ($ps eq $tmppostfile or $ps eq $tmppostfile.".post" ) { + if ($ps eq $tmppostfile ) { # build xdsh queue # build host and all scripts to execute From 6570378a6101ef1ca6e5132d6e758290460c3db3 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Wed, 20 Feb 2019 22:20:46 -0500 Subject: [PATCH 3/3] fix issue PR #6001 resulted in test case updatenode_syncfile_EXECUTE failed #6016 --- xCAT-test/autotest/testcase/updatenode/cases0 | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/updatenode/cases0 b/xCAT-test/autotest/testcase/updatenode/cases0 index fef099f08..677568e6a 100644 --- a/xCAT-test/autotest/testcase/updatenode/cases0 +++ b/xCAT-test/autotest/testcase/updatenode/cases0 @@ -158,23 +158,33 @@ end start:updatenode_syncfile_EXECUTE label:others,updatenode -cmd:echo "echo hello > /tmp/test" > /tmp/file.post +cmd:mkdir -p /tmp/updatenode_syncfile_EXECUTE/ check:rc==0 -cmd:chmod a+x /tmp/file.post -cmd:echo "/tmp/file.post -> /tmp/file.post" > /install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.synclist -cmd:echo "EXECUTE:" >> /install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.synclist -cmd:echo "/tmp/file.post" >> /install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.synclist -cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=/install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.synclist +cmd:touch /tmp/updatenode_syncfile_EXECUTE/file +check:rc==0 +cmd:echo "echo hello > /tmp/test" > /tmp/updatenode_syncfile_EXECUTE/file.post +check:rc==0 +cmd:chmod a+x /tmp/updatenode_syncfile_EXECUTE/file.post +cmd:echo "/tmp/updatenode_syncfile_EXECUTE/file -> /tmp/file" > /tmp/updatenode_syncfile_EXECUTE/synclist +cmd:echo "EXECUTE:" >> /tmp/updatenode_syncfile_EXECUTE/synclist +cmd:echo "/tmp/updatenode_syncfile_EXECUTE/file.post" >> /tmp/updatenode_syncfile_EXECUTE/synclist +cmd:chdef -t osimage -o __GETNODEATTR($$CN,provmethod)__ synclists=/tmp/updatenode_syncfile_EXECUTE/synclist check:rc==0 cmd:updatenode $$CN -F check:rc==0 cmd:xdsh $$CN "cat /tmp/test" check:rc==0 check:output=~hello -cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists= +cmd:xdsh $$CN "rm -rf /tmp/test" +cmd:updatenode $$CN -F check:rc==0 -cmd:rm -rf /install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.synclist +cmd:xdsh $$CN "cat /tmp/test" +check:rc!=0 +check:output=~No such file or directory +cmd:xdsh $$CN "rm -rf /tmp/test" +cmd:chdef -t osimage -o __GETNODEATTR($$CN,provmethod)__ synclists= check:rc==0 +cmd:rm -rf /tmp/updatenode_syncfile_EXECUTE/ end start:updatenode_syncfile_EXECUTEALWAYS