summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorGarrett Holmstrom <gholms@eucalyptus.com>2013-09-20 16:04:49 -0700
committerGarrett Holmstrom <gholms@eucalyptus.com>2013-09-20 16:04:49 -0700
commit4050105c1cfb100e6b93c56a74ecd2fe29d87608 (patch)
tree6fadc662546912cef83bef5ae7840a11e442274a /cloudinit/util.py
parent266d12c5777d5fba97c374c33cb4f31d50e2d347 (diff)
downloadvyos-cloud-init-4050105c1cfb100e6b93c56a74ecd2fe29d87608.tar.gz
vyos-cloud-init-4050105c1cfb100e6b93c56a74ecd2fe29d87608.zip
Some containers lack /dev/console, so when multi_log attempts to open
that device and write to it directly things can start going haywire. Here we address this problem by sending console-bound output to stdout and letting init take care of getting it to the console instead. We already configure upstart with "console output", so we need only change systemd to use "journal+console".
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index d50d3e18..02890448 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -360,11 +360,11 @@ def multi_log(text, console=True, stderr=True,
if stderr:
sys.stderr.write(text)
if console:
- # Don't use the write_file since
- # this might be 'sensitive' info (not debug worthy?)
- with open('/dev/console', 'wb') as wfh:
- wfh.write(text)
- wfh.flush()
+ # Some containers lack /dev/console, so we send output to
+ # stdout and configure upstart with "console output" and
+ # systemd with "journal+console" and let them take care of
+ # getting output to the console.
+ print text
if log:
if text[-1] == "\n":
log.log(log_level, text[:-1])