diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 1fd552528..e7a1cb19a 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,10 @@ sub run_rsync_postscripts } next; } - if ($tmppostfile eq $ps) { + + #the $postsfile .post will be run if: + # the is updated, or + if ($ps eq $tmppostfile ) { # build xdsh queue # build host and all scripts to execute 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