summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-06-01 16:53:55 +0100
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2015-06-03 14:11:19 +0100
commite7027e591c4fea5235a33bbe2cda809ddbe6bbf0 (patch)
treed9c7c7c15b6db4d057c655b3aa538d04c8efd87b
parent56c7db5201f548aff7950e778ca0e106709623ae (diff)
downloadmorph-e7027e591c4fea5235a33bbe2cda809ddbe6bbf0.tar.gz
Add separate_mount_namespace kwarg to ext runner
Sometimes we don't want a separate mount namespace Change-Id: I9f2645f552c69090612aecd45104a0320cd436c2
-rw-r--r--morphlib/extensions.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/morphlib/extensions.py b/morphlib/extensions.py
index aa0622b8..59281d66 100644
--- a/morphlib/extensions.py
+++ b/morphlib/extensions.py
@@ -202,7 +202,7 @@ class ExtensionSubprocess(object):
self._report_stderr = report_stderr
self._report_logger = report_logger
- def run(self, filename, args, cwd, env):
+ def run(self, filename, args, cwd, env, separate_mount_namespace=True):
'''Run an extension.
Anything written by the extension to stdout is passed to status(), thus
@@ -223,8 +223,14 @@ class ExtensionSubprocess(object):
# need to inherit
def close_read_end():
os.close(log_read_fd)
+
+ cmdline = [filename] + list(args)
+
+ if separate_mount_namespace:
+ cmdline = morphlib.util.unshared_cmdline(cmdline)
+
p = subprocess.Popen(
- morphlib.util.unshared_cmdline([filename] + list(args)),
+ cmdline,
cwd=cwd, env=new_env,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
preexec_fn=close_read_end)