summaryrefslogtreecommitdiff
path: root/ybd/app.py
diff options
context:
space:
mode:
authorAndrew Leeming <andrew.leeming@codethink.co.uk>2016-10-24 16:37:43 +0100
committerGitLab <gitlab@gitlab.com>2016-10-26 11:46:03 +0000
commit08b699b0f026078424d846f74f037b5ed9ee464e (patch)
tree500b0fec53050111eb4a6c9f5863de05a94fc385 /ybd/app.py
parent4e3a725db190e4416bf1578e47c8304ba82876e4 (diff)
downloadybd-08b699b0f026078424d846f74f037b5ed9ee464e.tar.gz
Patch for bubblewrap backendleeming/bwrap-dev-patch
Since Bubblewrap is able to run without root permissions, the alert that YBD shows when running non-root has been modified to pass if sandboxlib backend is bubblewrap. /dev is also explicitly listed as a mount in bootstrap mode due to the way bubblewrap arguments need to be listed (dev is special)
Diffstat (limited to 'ybd/app.py')
-rw-r--r--ybd/app.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ybd/app.py b/ybd/app.py
index 51dc2d9..a460a42 100644
--- a/ybd/app.py
+++ b/ybd/app.py
@@ -34,6 +34,8 @@ try:
except ImportError:
riemann_available = False
+import sandbox
+import sandboxlib
config = {}
defs = {}
@@ -160,7 +162,9 @@ def setup(args, original_cwd=""):
os.path.join(os.path.dirname(__file__), '..', 'ybd.conf'),
os.path.join(os.path.dirname(__file__), 'config', 'ybd.conf')])
- if not os.geteuid() == 0 and config.get('mode') == 'normal':
+ # chroot and linux_user_chroot both need to be run as root
+ if sandbox.executor in [sandboxlib.chroot, sandboxlib.linux_user_chroot] \
+ and not os.geteuid() == 0 and config.get('mode') == 'normal':
log('SETUP', '%s needs root permissions' % sys.argv[0], exit=True)
if config.get('kbas-url', 'http://foo.bar/') == 'http://foo.bar/':