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 <filbranden@google.com>
pull/6/head
Filipe Brandenburger 2014-08-27 22:49:34 -07:00
parent dc4becd976
commit 54b2ed0078
1 changed files with 3 additions and 1 deletions

View File

@ -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