Drop file test before removal

If the file is already missing (e.g. has been removed already), the test
-f will return 1 which fails the container-puppet.sh execution. The goal
here is to just make sure the file is missing, so let's just try to
removing it with only an rm -f. This is successful if the file is
already missing so we don't need to check the file existance.

Change-Id: I41bbff148267de6514bf5b88c344d18cb894ae01
Closes-Bug: #1853183
(cherry picked from commit 3ade96f768)
This commit is contained in:
Alex Schultz 2019-11-22 10:22:39 -07:00
parent 73d28b6e2a
commit a034963464
1 changed files with 1 additions and 1 deletions

View File

@ -121,7 +121,7 @@ if [ -z "$NO_ARCHIVE" ]; then
echo "Ensuring the removed config files are also purged in ${puppet_generated_path}:"
cat $TMPFILE | sort
cat $TMPFILE | xargs -n1 -r -I{} \
bash -c "test -f ${puppet_generated_path}/{} && rm -f ${puppet_generated_path}/{}"
bash -c "rm -f ${puppet_generated_path}/{}"
exec 5>&1
exec 1>$TMPFILE2
find $rsync_srcs -newer $origin_of_time -not -path '/etc/puppet*' -print0