From 30f342638df0f4deaa26fc5bece039e500e9cf5d Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 12 Nov 2014 20:33:14 +1100 Subject: [PATCH] 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 --- functions.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/functions.sh b/functions.sh index 93478c07..3d913db0 100644 --- a/functions.sh +++ b/functions.sh @@ -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