aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/admin/vespa-wrapper/configserver/check.go
blob: a0248dd128f1781d9978a5610bb3bd173719d535 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Author: arnej

package configserver

import (
	"fmt"

	"github.com/vespa-engine/vespa/client/go/internal/admin/defaults"
	"github.com/vespa-engine/vespa/client/go/internal/admin/trace"
	"github.com/vespa-engine/vespa/client/go/internal/util"
)

func checkIsConfigserver(myname string) {
	onlyHosts := defaults.VespaConfigserverHosts()
	for _, hn := range onlyHosts {
		if hn == "localhost" || hn == myname {
			trace.Debug("should run configserver:", hn)
			return
		}
	}
	trace.Warning("only these hosts should run a config server:", onlyHosts)
	util.JustExitMsg(fmt.Sprintf("this host [%s] should not run a config server", myname))
}