open-nomad/client/fingerprint/nomad.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
912 B
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
2016-03-23 00:12:30 +00:00
package fingerprint
import (
"strconv"
log "github.com/hashicorp/go-hclog"
2016-03-23 00:12:30 +00:00
)
// NomadFingerprint is used to fingerprint the Nomad version
type NomadFingerprint struct {
StaticFingerprinter
logger log.Logger
2016-03-23 00:12:30 +00:00
}
// NewNomadFingerprint is used to create a Nomad fingerprint
func NewNomadFingerprint(logger log.Logger) Fingerprint {
f := &NomadFingerprint{logger: logger.Named("nomad")}
2016-03-23 00:12:30 +00:00
return f
}
func (f *NomadFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error {
resp.AddAttribute("nomad.advertise.address", req.Node.HTTPAddr)
resp.AddAttribute("nomad.version", req.Config.Version.VersionNumber())
resp.AddAttribute("nomad.revision", req.Config.Version.Revision)
resp.AddAttribute("nomad.service_discovery", strconv.FormatBool(req.Config.NomadServiceDiscovery))
2018-01-31 22:03:55 +00:00
resp.Detected = true
return nil
2016-03-23 00:12:30 +00:00
}