Move checks of running catalyst into the target which is simpler
authorEric Edgar <rocket@gentoo.org>
Thu, 17 Nov 2005 22:04:26 +0000 (22:04 +0000)
committerEric Edgar <rocket@gentoo.org>
Thu, 17 Nov 2005 22:04:26 +0000 (22:04 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@894 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
catalyst
modules/generic_stage_target.py

index 90c92ab1751c160c1377283c28a89e257b62ec2c..3c3165cd9446542a387b021adb10c15646d9771d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.382 2005/11/17 20:56:15 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.383 2005/11/17 22:04:26 rocket Exp $
+
+  17 Nov 2005; Eric Edgar <rocket@gentoo.org> catalyst,
+  modules/generic_stage_target.py:
+  Move checks of running catalyst into the target which is simpler
 
   17 Nov 2005; Eric Edgar <rocket@gentoo.org>
   modules/generic_stage_target.py:
index 9b9c545884a3640f92f2e09efc9dfc6a643864eb..c80fbb60dc5e2af425287a640d5d1650029aa2da 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.97 2005/11/17 20:27:57 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.98 2005/11/17 22:04:26 rocket Exp $
 
 # Maintained in full by:
 # Eric Edgar <rocket@gentoo.org>
@@ -190,27 +190,11 @@ def build_target(addlargs, targetmap):
                
                mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
        
-               # Kill any pids in the chroot 
-               mytarget.kill_chroot_pids()
-
-               # Check for mounts right away and abort if we cannot unmount them.
-               mytarget.mount_safety_check()
-
-               if conf_values.has_key("CLEAR_AUTORESUME"):
-                   mytarget.clear_autoresume()
-               
-               if conf_values.has_key("PURGE"):
-                   mytarget.purge()
-               
                mytarget.run()
 
-       except CatalystError:
-               try:
-                   mytarget.mount_safety_check()
-               except:
-                   pass
-               sys.exit(1)
-       
+       except:
+               raise
+
 if __name__ == "__main__":
        targetmap={}
        
index a02d4e7cc1d2f5d6d0571ecdfa1edcefc3b98dfa..f356826d9b290238f7bd0fc9d5a728b46966f750 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.76 2005/11/17 20:56:16 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.77 2005/11/17 22:04:26 rocket Exp $
 
 """
 This class does all of the chroot setup, copying of files, etc. It is
@@ -478,14 +478,14 @@ class generic_stage_target(generic_target):
                        if ismount(mypath+x):
                                #something is still mounted
                                try:
-                                       print x+" is still mounted; performing auto-bind-umount..."
+                                       print x+" is still mounted; performing auto-bind-umount...",
                                        # try to umount stuff ourselves
                                        self.unbind()
                                        if ismount(mypath+x):
                                                raise CatalystError, "Auto-unbind failed for "+x
                                        
                                        else:
-                                               print "Auto-unbind successful, continuing..."
+                                               print "Auto-unbind successful..."
                                
                                except CatalystError:
                                        raise CatalystError, "Unable to auto-unbind "+x
@@ -923,13 +923,24 @@ class generic_stage_target(generic_target):
        def run(self):
                self.chroot_lock.write_lock()
 
+                # Kill any pids in the chroot
+                self.kill_chroot_pids()
+
+                # Check for mounts right away and abort if we cannot unmount them.
+                self.mount_safety_check()
+
+                if self.settings.has_key("CLEAR_AUTORESUME"):
+                        self.clear_autoresume()
+                if self.settings.has_key("PURGE"):
+                        self.purge()
+
                for x in self.settings["action_sequence"]:
                        print "Running action sequence: "+x
                        sys.stdout.flush()
                        try:
                                apply(getattr(self,x))
                        except:
-                               self.unbind()
+                               self.mount_safety_check()
                                raise
                
                self.chroot_lock.unlock()