copy_puppet_logs: use SUDO to rename config/log files

In a previous commit [1], we stopped changing the owner to manually set
file mode bits. The problem is that 644 is not enough for files, because
they need to be renamed so write permissions are needed.

This patch aims to make sure files can be renamed by any user, so we
use SUDO prefix for each 'mv' command.

[1] I1c93a841b82514fb146d827332eecea98d9dbd3b

Change-Id: I2ea4b090c99af33dd0095cbe664cd4187b114b54
This commit is contained in:
Emilien Macchi 2016-01-26 08:09:46 -05:00
parent c1b98cd198
commit 70837e7f58

View File

@ -181,13 +181,13 @@ done
# append .txt to all config files
# (there are some /etc/swift .builder and .ring files that get
# caught up which aren't really text, don't worry about that)
find $LOG_DIR/sudoers.d $LOG_DIR/etc -type f -exec mv '{}' '{}'.txt \;
find $LOG_DIR/sudoers.d $LOG_DIR/etc -type f -exec sudo mv '{}' '{}'.txt \;
# rabbitmq
if [ -f $LOG_DIR/rabbitmq ]; then
find $LOG_DIR/rabbitmq -type f -exec mv '{}' '{}'.txt \;
find $LOG_DIR/rabbitmq -type f -exec sudo mv '{}' '{}'.txt \;
for X in `find $LOG_DIR/rabbitmq -type f` ; do
mv "$X" "${X/@/_at_}"
sudo mv "$X" "${X/@/_at_}"
done
fi