summaryrefslogtreecommitdiffstats
path: root/py/mock/backend.py
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2008-01-08 13:59:05 -0600
committerMichael E Brown <michael_e_brown@dell.com>2008-01-08 13:59:05 -0600
commitcc889dbb4ed40909ffd6c29bc29623cfcf1a1ca5 (patch)
tree267a3c445488c762f13166b4cb94ad284e8099e2 /py/mock/backend.py
parent552c3bbe3331f5a7727010a0420d11159777ea90 (diff)
downloadmock-cc889dbb4ed40909ffd6c29bc29623cfcf1a1ca5.tar.gz
mock-cc889dbb4ed40909ffd6c29bc29623cfcf1a1ca5.tar.xz
mock-cc889dbb4ed40909ffd6c29bc29623cfcf1a1ca5.zip
add initfailed hook so tmpfs plugin can properly unmount tmpfs on failure. make sure we call postbuild hooks even on failure.
Diffstat (limited to 'py/mock/backend.py')
-rw-r--r--py/mock/backend.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/py/mock/backend.py b/py/mock/backend.py
index 0ae7076..f0cf4a6 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -147,6 +147,14 @@ class Root(object):
decorate(traceLog())
def init(self):
+ try:
+ self._init()
+ except (KeyboardInterrupt, Exception):
+ self._callHooks('initfailed')
+ raise
+
+ decorate(traceLog())
+ def _init(self):
self.state("init")
# NOTE: removed the following stuff vs mock v0:
@@ -425,8 +433,8 @@ class Root(object):
self.uidManager.restorePrivs()
self._umountall()
- # tell caching we are done building
- self._callHooks('postbuild')
+ # tell caching we are done building
+ self._callHooks('postbuild')
# =============
# 'Private' API