diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2015-06-09 14:57:41 +0100 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2015-06-09 15:25:40 +0100 |
commit | e961f82127860d8efd3cfd9aa10f2cd4820d74f6 (patch) | |
tree | 87f4ccd3da379f1f14a2a22858a57d1131609d33 | |
parent | b89b44ca72a2ae83ab0eb6435831d78199f4da24 (diff) | |
download | sandboxlib-e961f82127860d8efd3cfd9aa10f2cd4820d74f6.tar.gz |
Fix some mistakes in chroot backend
-rw-r--r-- | sandboxlib/chroot.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sandboxlib/chroot.py b/sandboxlib/chroot.py index 127bbab..71e45e4 100644 --- a/sandboxlib/chroot.py +++ b/sandboxlib/chroot.py @@ -53,15 +53,16 @@ def degrade_config_for_capabilities(in_config, warn=True): # Currently this is all done manually... it may make sense to add something # in utils.py that automatically checks the config against CAPABILITIES. out_config = in_config.copy() - backend = 'chroot' def degrade_and_warn(name, allowed_value): - out_config[name] = allowed_value if warn: + backend = 'chroot' + value = out_config[name] msg = ( 'Unable to set %(name)s=%(value)s in a %(backend)s sandbox, ' - 'falling back to %(name)s=%(allowed_value)s'.format(locals())) + 'falling back to %(name)s=%(allowed_value)s' % locals()) warnings.warn(msg) + out_config[name] = allowed_value if out_config.get('mounts', 'undefined') != 'undefined': degrade_and_warn('mounts', 'undefined') @@ -70,7 +71,7 @@ def degrade_config_for_capabilities(in_config, warn=True): degrade_and_warn('network', 'undefined') if out_config.get('filesystem_writable_paths', 'all') != 'all': - degrade_and_warn('network', 'all') + degrade_and_warn('filesystem_writable_paths', 'all') return out_config |