summaryrefslogtreecommitdiffstats
path: root/py/mock/plugins
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2007-12-18 13:50:30 -0600
committerMichael E Brown <michael_e_brown@dell.com>2007-12-18 13:50:30 -0600
commite65d55ea8421f573c9a7e4ab0184afdcc89f2f51 (patch)
treea2515e46df9d572130a0c6f0438a64a18f22d671 /py/mock/plugins
parent6a0638f95c5271b069d308c5f53062aace7b4283 (diff)
downloadmock-e65d55ea8421f573c9a7e4ab0184afdcc89f2f51.tar.gz
mock-e65d55ea8421f573c9a7e4ab0184afdcc89f2f51.tar.xz
mock-e65d55ea8421f573c9a7e4ab0184afdcc89f2f51.zip
add initial tmpfs plugin and default options.
Diffstat (limited to 'py/mock/plugins')
-rw-r--r--py/mock/plugins/tmpfs.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/py/mock/plugins/tmpfs.py b/py/mock/plugins/tmpfs.py
new file mode 100644
index 0000000..10cce33
--- /dev/null
+++ b/py/mock/plugins/tmpfs.py
@@ -0,0 +1,33 @@
+# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
+# License: GPL2 or later see COPYING
+# Written by Michael Brown
+# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
+
+# python library imports
+import os
+
+# our imports
+from mock.trace_decorator import decorate, traceLog, getLog
+import mock.util
+
+requires_api_version = "1.0"
+
+# plugin entry point
+decorate(traceLog())
+def init(rootObj, conf):
+ Tmpfs(rootObj, conf)
+
+# classes
+class Tmpfs(object):
+ """Mounts a tmpfs on the chroot dir"""
+ decorate(traceLog())
+ def __init__(self, rootObj, conf):
+ self.rootObj = rootObj
+ self.conf = conf
+ rootObj.addHook("preinit", self._tmpfsPreInitHook)
+
+ decorate(traceLog())
+ def _tmpfsPreInitHook(self):
+ mountCmd = "mount -n -t tmpfs mock_chroot_tmpfs %s" % self.makeChrootPath()
+ mock.util.do(mountCmd)
+