summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 6c5cf741..05cb587c 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1762,7 +1762,7 @@ def delete_dir_contents(dirname):
def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,
- logstring=False, decode="replace", target=None):
+ logstring=False, decode="replace", target=None, update_env=None):
# not supported in cloud-init (yet), for now kept in the call signature
# to ease maintaining code shared between cloud-init and curtin
@@ -1773,6 +1773,13 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,
rcs = [0]
devnull_fp = None
+
+ if update_env:
+ if env is None:
+ env = os.environ
+ env = env.copy()
+ env.update(update_env)
+
try:
if target_path(target) != "/":
args = ['chroot', target] + list(args)