From e79610f23c585017da411eea0a5d76b9876eacc4 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Wed, 6 Jul 2016 11:22:15 +0200 Subject: [PATCH] Don't try to use hostnamectl when systemd isn't running --- cdist/conf/type/__hostname/explorer/has_hostnamectl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__hostname/explorer/has_hostnamectl b/cdist/conf/type/__hostname/explorer/has_hostnamectl index 9040023d..7e8a57fd 100755 --- a/cdist/conf/type/__hostname/explorer/has_hostnamectl +++ b/cdist/conf/type/__hostname/explorer/has_hostnamectl @@ -18,7 +18,12 @@ # along with cdist. If not, see . # # -# Check whether system has hostnamectl +# Check whether system has hostnamectl and it's usable, i.e. don't +# try to use it when systemd isn't running yet. # -command -v hostnamectl || true +if command -v hostnamectl >/dev/null && hostnamectl status >/dev/null 2>&1; then + echo "yes" +else + true +fi