Fix up sudo wildcard copy

There are a few places where we do "sudo cp /foo/* $BASE/logs" which
doesn't work when the user can't access /foo/* to expand the
wild-card.

Convert these to use a "cp -r" of the directory.

There's no reason to assume qemu is the only virt-type used
(seeIeb3e20e8c70155ed2ee73e632df7f271212ed3a6), so just copy all
libvirtd logs and leave the hierarchy alone -- anything in there is
very likely to be helpful for forensics of failures.

Change-Id: I3b949c7660efe1b5158a72b6b8ccbd0d7b9a0b38
This commit is contained in:
Ian Wienand
2014-11-12 20:33:14 +11:00
parent c940790518
commit 30f342638d

View File

@@ -508,8 +508,7 @@ function cleanup_host {
# rabbitmq logs
if [ -d /var/log/rabbitmq ]; then
sudo mkdir $BASE/logs/rabbitmq/
sudo cp /var/log/rabbitmq/* $BASE/logs/rabbitmq/
sudo cp -r /var/log/rabbitmq $BASE/logs
fi
# db logs
@@ -527,16 +526,11 @@ function cleanup_host {
# libvirt
if [ -d /var/log/libvirt ] ; then
sudo cp /var/log/libvirt/libvirtd*.log $BASE/logs/
if [ -d /var/log/libvirt/qemu ] ; then
sudo mkdir $BASE/logs/qemu
sudo cp /var/log/libvirt/qemu/* $BASE/logs/qemu/
fi
sudo cp -r /var/log/libvirt $BASE/logs/
fi
# sudo config
sudo mkdir $BASE/logs/sudoers.d/
sudo cp /etc/sudoers.d/* $BASE/logs/sudoers.d/
sudo cp -r /etc/sudoers.d $BASE/logs/
sudo cp /etc/sudoers $BASE/logs/sudoers.txt
# Archive config files