From 54b2ed0078a0714baed88165d53bfeeabbc4c4dd Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Wed, 27 Aug 2014 22:49:34 -0700 Subject: [PATCH] Suppress non-error output of `systemctl enable` The `systemctl enable` command ordinarily prints the `ln` command used to enable the unit to stderr, but that's not ideal in the vagrant setup because it gets printed in red, which should be reserved for errors, but it's not a real error. Set an environment variable to raise the log level to prevent `info` messages from being printed to stderr (as they are not actually errors.) I looked into the `systemctl` calls happening from the Salt setup script to understand why they were not going to stderr, and it turns out the Salt script will redirect all messages to stdout so they will all be green regardless... Tested: - Started a fresh Vagrant cluster, confirmed no red messages in output when creating the cluster successfully. Successfully started nginx through Kubernetes using cluster/kubecfg.sh. - Confirmed that the salt-api service was up after `vagrant up`: $ vagrant ssh master -c 'systemctl status salt-api.service' salt-api.service - The Salt API Loaded: loaded (/usr/lib/systemd/system/salt-api.service; enabled) Active: active (running) since Fri 2014-08-29 23:19:47 UTC; 11min ago Main PID: 2090 (salt-api) CGroup: /system.slice/salt-api.service +-2090 /usr/bin/python /usr/bin/salt-api +-2110 /usr/bin/python /usr/bin/salt-api Signed-off-by: Filipe Brandenburger --- cluster/vagrant/provision-master.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster/vagrant/provision-master.sh b/cluster/vagrant/provision-master.sh index a7d4d629c1..9b560e3086 100755 --- a/cluster/vagrant/provision-master.sh +++ b/cluster/vagrant/provision-master.sh @@ -86,7 +86,9 @@ EOF # # This is used to inform the cloud provider used in the vagrant cluster yum install -y salt-api - systemctl enable salt-api + # Set log level to a level higher than "info" to prevent the message about + # enabling the service (which is not an error) from being printed to stderr. + SYSTEMD_LOG_LEVEL=notice systemctl enable salt-api systemctl start salt-api fi