First impressions of mock 1.1.3

Paul Howarth paul at city-fan.org
Wed Aug 11 09:18:11 UTC 2010


On 08/08/10 18:26, Paul Howarth wrote:
> New option max_fs_size for tmpfs plugin doesn't seem to have a default
> value; at least I get a traceback if I use my old config, which had
> just:
>
> config_opts['plugin_conf']['tmpfs_enable']                      = True
> config_opts['plugin_conf']['tmpfs_opts']['required_ram_mb']     = 2048

Actually that's not true. The syntax above doesn't cause a traceback. 
What I actually had was:

config_opts['plugin_conf']['tmpfs_enable'] = True
config_opts['plugin_conf']['tmpfs_opts'] = {'required_ram_mb': 2048}

And the resulting traceback was:

INFO: mock.py version 1.1.3 starting...
State Changed: init plugins
ERROR: 'max_fs_size'
Traceback (most recent call last):
   File "/usr/sbin/mock", line 748, in <module>
     main(retParams)
   File "/usr/sbin/mock", line 587, in main
     chroot = mock.backend.Root(config_opts, uidManager)
   File "<peak.util.decorators.rewrap wrapping mock.backend.__init__ at 
0x01811938>", line 3, in __init__
     def __init__(self, config, uidManager): return __decorated(self, 
config, uidManager)
   File "/usr/lib/python2.6/site-packages/mock/trace_decorator.py", line 
70, in trace
     result = func(*args, **kw)
   File "/usr/lib/python2.6/site-packages/mock/backend.py", line 102, in 
__init__
     self._initPlugins()
   File "<peak.util.decorators.rewrap wrapping mock.backend._initPlugins 
at 0x01818398>", line 3, in _initPlugins
     def _initPlugins(self): return __decorated(self)
   File "/usr/lib/python2.6/site-packages/mock/trace_decorator.py", line 
70, in trace
     result = func(*args, **kw)
   File "/usr/lib/python2.6/site-packages/mock/backend.py", line 623, in 
_initPlugins
     module.init(self, self.pluginConf["%s_opts" % modname])
   File "<peak.util.decorators.rewrap wrapping tmpfs.init at 
0x01814410>", line 3, in init
     def init(rootObj, conf): return __decorated(rootObj, conf)
   File "/usr/lib/python2.6/site-packages/mock/trace_decorator.py", line 
70, in trace
     result = func(*args, **kw)
   File "/usr/lib/python2.6/site-packages/mock/plugins/tmpfs.py", line 
21, in init
     Tmpfs(rootObj, conf)
   File "<peak.util.decorators.rewrap wrapping tmpfs.__init__ at 
0x017C3320>", line 3, in __init__
     def __init__(self, rootObj, conf): return __decorated(self, 
rootObj, conf)
   File "/usr/lib/python2.6/site-packages/mock/trace_decorator.py", line 
70, in trace
     result = func(*args, **kw)
   File "/usr/lib/python2.6/site-packages/mock/plugins/tmpfs.py", line 
36, in __init__
     self.maxSize = self.conf['max_fs_size']
KeyError: 'max_fs_size'

Updating the mock config to set the options individually as per the 
examples in site-defaults.cfg fixed that problem.

Paul.


More information about the buildsys mailing list