Skip to content

Commit

Permalink
etcdmain: correctly check return values from SdNotify()
Browse files Browse the repository at this point in the history
SdNotify() now returns 2 values, sent and err. So startEtcdOrProxyV2()
needs to check the 2 return values correctly. As the 2 values are
independent of each other, error checking needs to be slightly updated
too.

SdNotifyNoSocket, which was previously provided by go-systemd, does not
exist any more. In that case (false, nil) will be returned instead.
  • Loading branch information
Dongsu Park authored and dongsupark committed Jul 21, 2016
1 parent d696d00 commit 8607ac3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ func startEtcdOrProxyV2() {
// for accepting connections. The etcd instance should be
// joined with the cluster and ready to serve incoming
// connections.
err := daemon.SdNotify("READY=1")
sent, err := daemon.SdNotify("READY=1")
if err != nil {
plog.Errorf("failed to notify systemd for readiness: %v", err)
if err == daemon.SdNotifyNoSocket {
plog.Errorf("forgot to set Type=notify in systemd service file?")
}
}
if !sent {
plog.Errorf("forgot to set Type=notify in systemd service file?")
}
}

Expand Down

0 comments on commit 8607ac3

Please sign in to comment.