From fbf732d3dc90e32263a6f4c4da1f5ef1fce7f889 Mon Sep 17 00:00:00 2001 From: Sergey Shatunov Date: Sat, 2 Mar 2019 23:41:15 +0700 Subject: [PATCH] etcdmain: fix sd_notify for restricted environments Remove call to dumb IsRunningSystemd() as it doesn't check anything --- etcdmain/main.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/etcdmain/main.go b/etcdmain/main.go index b4f91d816..47e480dcb 100644 --- a/etcdmain/main.go +++ b/etcdmain/main.go @@ -20,7 +20,6 @@ import ( "strings" "github.com/coreos/go-systemd/daemon" - systemdutil "github.com/coreos/go-systemd/util" "go.uber.org/zap" ) @@ -48,14 +47,7 @@ func Main() { } func notifySystemd(lg *zap.Logger) { - if !systemdutil.IsRunningSystemd() { - return - } - - if lg != nil { - lg.Info("host was booted with systemd, sends READY=1 message to init daemon") - } - sent, err := daemon.SdNotify(false, "READY=1") + _, err := daemon.SdNotify(false, daemon.SdNotifyReady) if err != nil { if lg != nil { lg.Error("failed to notify systemd for readiness", zap.Error(err)) @@ -63,12 +55,4 @@ func notifySystemd(lg *zap.Logger) { plog.Errorf("failed to notify systemd for readiness: %v", err) } } - - if !sent { - if lg != nil { - lg.Warn("forgot to set Type=notify in systemd service file?") - } else { - plog.Errorf("forgot to set Type=notify in systemd service file?") - } - } }