On 07/14/2009 05:45 PM, Jeff Schroeder wrote:
On Tue, Jul 14, 2009 at 2:03 PM, Leonid Flaks<flaks@bnl.gov> wrote:
  
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
    

Please do not fork a subshell here. Use an if statement so the code is
more readable. If only there was PEP8 for bash :)
  

We can actually invoke %posts in python with --interpeter, you know :)

(But I would not be that evil...especially considering lack of useful modules on older distros which folks may have to still install (EL 2/3))