[Pkg-escience-soc2009] [SCM] Tool for creating VM images. branch, master, updated. 06f8c717989bc8084454638873d9a981ffa644a1

David Wendt kmeisthax at Lappy-486.A
Wed Jul 22 02:26:36 UTC 2009


The following commit has been merged in the master branch:
commit 1a432b6c6c713fbe3eef9c3b75e5921b0cc0abac
Author: David Wendt <kmeisthax at Lappy-486.A>
Date:   Tue Jul 21 12:35:56 2009 -0400

    added --pause-on-failure debugging option, which pauses 10 secs when an exception occurs if enabled with the flag.

diff --git a/VMBuilder/vm.py b/VMBuilder/vm.py
index 723d372..e11abab 100644
--- a/VMBuilder/vm.py
+++ b/VMBuilder/vm.py
@@ -146,6 +146,7 @@ class VM(object):
         self.register_setting('-d', '--dest', dest='destdir', help='Specify the destination directory. [default: <hypervisor>-<distro>].')
         self.register_setting('-c', '--config',  type='string', help='Specify a additional configuration file')
         self.register_setting('--debug', action='callback', callback=log.set_verbosity, help='Show debug information')
+        self.register_setting('--pause-on-failure', action='store_true', default=False, help='Sleep for 10 seconds if an exception occurs, for debugging usage')
         self.register_setting('-v', '--verbose', action='callback', callback=log.set_verbosity, help='Show progress information')
         self.register_setting('-q', '--quiet', action='callback', callback=log.set_verbosity, help='Silent operation')
         self.register_setting('-t', '--tmp', default=os.environ.get('TMPDIR', '/tmp'), help='Use TMP as temporary working space for image generation. Defaults to $TMPDIR if it is defined or /tmp otherwise. [default: %default]')
@@ -504,6 +505,12 @@ class VM(object):
         finally:
             if not finished:
                 logging.debug("Oh, dear, an exception occurred")
+                #Option to make it easier to debug exceptions
+                if self.pause_on_failure:
+                    import time
+                    logging.info("VMbuilder has been paused for 10 seconds. Press ^Z to suspend, or forever hold your peace...")
+                    time.sleep(10)
+
             self.cleanup()
 
 class _MyOptParser(optparse.OptionParser):

-- 
Tool for creating VM images.



More information about the Pkg-escience-soc2009 mailing list