From 1b39f6bbcf2cf38a54313080cab5b4e13edfe0bb Mon Sep 17 00:00:00 2001 From: Garrett Holmstrom Date: Fri, 20 Sep 2013 16:22:34 -0700 Subject: [PATCH] Let systemd handle console output https://bugzilla.redhat.com/show_bug.cgi?id=977952 https://bugs.launchpad.net/bugs/1228434 --- cloud-init-0.7.2-nodevconsole.patch | 73 +++++++++++++++++++++++++++++ cloud-init.spec | 9 ++++ 2 files changed, 82 insertions(+) create mode 100644 cloud-init-0.7.2-nodevconsole.patch diff --git a/cloud-init-0.7.2-nodevconsole.patch b/cloud-init-0.7.2-nodevconsole.patch new file mode 100644 index 0000000..2fae295 --- /dev/null +++ b/cloud-init-0.7.2-nodevconsole.patch @@ -0,0 +1,73 @@ +Index: cloud-init-0.7.2/cloudinit/util.py +=================================================================== +--- cloud-init-0.7.2.orig/cloudinit/util.py ++++ cloud-init-0.7.2/cloudinit/util.py +@@ -361,11 +361,11 @@ def multi_log(text, console=True, stderr + 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]) +Index: cloud-init-0.7.2/systemd/cloud-config.service +=================================================================== +--- cloud-init-0.7.2.orig/systemd/cloud-config.service ++++ cloud-init-0.7.2/systemd/cloud-config.service +@@ -11,7 +11,7 @@ RemainAfterExit=yes + TimeoutSec=0 + + # Output needs to appear in instance console output +-StandardOutput=tty ++StandardOutput=journal+console + + [Install] + WantedBy=multi-user.target +Index: cloud-init-0.7.2/systemd/cloud-final.service +=================================================================== +--- cloud-init-0.7.2.orig/systemd/cloud-final.service ++++ cloud-init-0.7.2/systemd/cloud-final.service +@@ -11,7 +11,7 @@ RemainAfterExit=yes + TimeoutSec=0 + + # Output needs to appear in instance console output +-StandardOutput=tty ++StandardOutput=journal+console + + [Install] + WantedBy=multi-user.target +Index: cloud-init-0.7.2/systemd/cloud-init-local.service +=================================================================== +--- cloud-init-0.7.2.orig/systemd/cloud-init-local.service ++++ cloud-init-0.7.2/systemd/cloud-init-local.service +@@ -10,7 +10,7 @@ RemainAfterExit=yes + TimeoutSec=0 + + # Output needs to appear in instance console output +-StandardOutput=tty ++StandardOutput=journal+console + + [Install] + WantedBy=multi-user.target +Index: cloud-init-0.7.2/systemd/cloud-init.service +=================================================================== +--- cloud-init-0.7.2.orig/systemd/cloud-init.service ++++ cloud-init-0.7.2/systemd/cloud-init.service +@@ -11,7 +11,7 @@ RemainAfterExit=yes + TimeoutSec=0 + + # Output needs to appear in instance console output +-StandardOutput=tty ++StandardOutput=journal+console + + [Install] + WantedBy=multi-user.target diff --git a/cloud-init.spec b/cloud-init.spec index 97ceb32..80c4cd6 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -20,6 +20,13 @@ Patch0: cloud-init-0.7.2-fedora.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1008250 Patch1: cloud-init-0.7.2-puppetagent.patch +# Send text to stdout instead of /dev/console, then tell systemd to send +# stdout to journal+console. Code that sends directly to syslog remains +# unchanged. +# https://bugzilla.redhat.com/show_bug.cgi?id=977952 +# https://bugs.launchpad.net/bugs/1228434 +Patch2: cloud-init-0.7.2-nodevconsole.patch + BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -58,6 +65,7 @@ ssh keys and to let the user run various scripts. %setup -q -n %{name}-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 cp -p %{SOURCE2} README.fedora @@ -140,6 +148,7 @@ fi %changelog * Fri Sep 20 2013 Garrett Holmstrom - 0.7.2-5 - Fixed puppet agent service name [RH:1008250] +- Let systemd handle console output [RH:977952 LP:1228434] * Sat Aug 03 2013 Fedora Release Engineering - 0.7.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild