summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2015-01-23 15:34:56 -0500
committerBarry Warsaw <barry@python.org>2015-01-23 15:34:56 -0500
commit3246c85763d5cdebb3e240fcd5ae29834cbf6299 (patch)
tree10fa3d16b31620b8c212f80b7c32f88774a53045 /cloudinit/util.py
parent3b798b5d5c3caa5d0e8e534855e29010ca932aaa (diff)
downloadvyos-cloud-init-3246c85763d5cdebb3e240fcd5ae29834cbf6299.tar.gz
vyos-cloud-init-3246c85763d5cdebb3e240fcd5ae29834cbf6299.zip
* Fix the filter() imports.
* In Py3, pass universal_newlines to subprocess.Popen()
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 94fd5c70..25c104c7 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1589,9 +1589,12 @@ def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,
stdout = subprocess.PIPE
stderr = subprocess.PIPE
stdin = subprocess.PIPE
- sp = subprocess.Popen(args, stdout=stdout,
- stderr=stderr, stdin=stdin,
- env=env, shell=shell)
+ kws = dict(stdout=stdout, stderr=stderr, stdin=stdin,
+ env=env, shell=shell)
+ if six.PY3:
+ # Use this so subprocess output will be (Python 3) str, not bytes.
+ kws['universal_newlines'] = True
+ sp = subprocess.Popen(args, **kws)
(out, err) = sp.communicate(data)
except OSError as e:
raise ProcessExecutionError(cmd=args, reason=e)