diff options
author | Michael E Brown <michael_e_brown@dell.com> | 2007-12-18 13:50:30 -0600 |
---|---|---|
committer | Michael E Brown <michael_e_brown@dell.com> | 2007-12-18 13:50:30 -0600 |
commit | e65d55ea8421f573c9a7e4ab0184afdcc89f2f51 (patch) | |
tree | a2515e46df9d572130a0c6f0438a64a18f22d671 | |
parent | 6a0638f95c5271b069d308c5f53062aace7b4283 (diff) | |
download | mock-e65d55ea8421f573c9a7e4ab0184afdcc89f2f51.tar.gz mock-e65d55ea8421f573c9a7e4ab0184afdcc89f2f51.tar.xz mock-e65d55ea8421f573c9a7e4ab0184afdcc89f2f51.zip |
add initial tmpfs plugin and default options.
-rw-r--r-- | etc/mock/defaults.cfg | 5 | ||||
-rwxr-xr-x | py/mock.py | 2 | ||||
-rw-r--r-- | py/mock/plugins/tmpfs.py | 33 |
3 files changed, 40 insertions, 0 deletions
diff --git a/etc/mock/defaults.cfg b/etc/mock/defaults.cfg index 2a68e0b..626ef99 100644 --- a/etc/mock/defaults.cfg +++ b/etc/mock/defaults.cfg @@ -60,8 +60,13 @@ # config_opts['plugin_conf']['root_cache_enable'] = True # config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15 # config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/" +# +# bind mount plugin is enabled by default but has no configured directories to mount # config_opts['plugin_conf']['bind_mount_enable'] = True # config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' )) +# +# config_opts['plugin_conf']['tmpfs_enable'] = False +# config_opts['plugin_conf']['tmpfs_opts'] = {} ############################################################################# # @@ -229,6 +229,8 @@ def setup_default_config_opts(config_opts, unprivUid): # ('/host/path', '/bind/mount/path/in/chroot/' ), # ('/another/host/path', '/another/bind/mount/path/in/chroot/'), ]}, + 'tmpfs_enable': False, + 'tmpfs_opts': {}, } # dependent on guest OS 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) + |