Brooke A. Storm wrote:
Thanks Michael and Leonid. I believe the odd error we encountered
would
be fixed by this because the directories created are using mktemp for
directory name generation. It will not conflict with Anaconda’s strange
desire to format the disks using special files it makes under /tmp
anymore. The short-circuit is still there, but it will no longer
matter. For our production environment, we are simply using the change
I made to our copy of the file. Thanks guys!
I think if I replace 'continue' with (rm -r /tmp/$tmpdir; continue) that
would make the snippet cleaner. I'll do it on both snippets (ssh and
cfengine).
I finally understood you situation (I hope!) - You had a failed mount
attempt - for example snippet tried to mount swap partition and the file
with the mount point was left behind in /tmp and it somehow crashed
anaconda which did not expect this file to be there. The latest version
uses more complicated file names with mktemp command that I borrowed
from lvm part of the original script.
--
Leon
diff --git a/snippets/keep_cfengine_keys b/snippets/keep_cfengine_keys
index 24f159e..06b3ec8 100644
--- a/snippets/keep_cfengine_keys
+++ b/snippets/keep_cfengine_keys
@@ -25,7 +25,7 @@ function findkeys
tmpdir=$(mktemp -d $name.XXXXXX)
mkdir -p /tmp/$tmpdir
mount $disk /tmp/$tmpdir
- [ $? -eq 0 ] || continue # Skip to the next partition if the mount fails
+ [ $? -eq 0 ] || (rm -r /tmp/$tmpdir; continue) # Skip to the next partition if the
mount fails
# Copy current host keys out to be reused
if [ -d /tmp/$tmpdir$SEARCHDIR ]; then
diff --git a/snippets/keep_ssh_host_keys b/snippets/keep_ssh_host_keys
index ce1d939..7f47d5f 100644
--- a/snippets/keep_ssh_host_keys
+++ b/snippets/keep_ssh_host_keys
@@ -25,7 +25,7 @@ function findkeys
tmpdir=$(mktemp -d $name.XXXXXX)
mkdir -p /tmp/$tmpdir
mount $disk /tmp/$tmpdir
- [ $? -eq 0 ] || continue # Skip to the next partition if the mount fails
+ [ $? -eq 0 ] || (rm -r /tmp/$tmpdir; continue) # Skip to the next partition if the
mount fails
# Copy current host keys out to be reused
if [ -d /tmp/$tmpdir$SEARCHDIR ]; then