open-nomad/client/fingerprint/nomad.go
Chelsea Holland Komlo 7b53474a6e add applicable boolean to fingerprint response
public fields and remove getter functions
2018-01-31 13:21:45 -05:00

27 lines
697 B
Go

package fingerprint
import (
"log"
cstructs "github.com/hashicorp/nomad/client/structs"
)
// NomadFingerprint is used to fingerprint the Nomad version
type NomadFingerprint struct {
StaticFingerprinter
logger *log.Logger
}
// NewNomadFingerprint is used to create a Nomad fingerprint
func NewNomadFingerprint(logger *log.Logger) Fingerprint {
f := &NomadFingerprint{logger: logger}
return f
}
func (f *NomadFingerprint) Fingerprint(req *cstructs.FingerprintRequest, resp *cstructs.FingerprintResponse) error {
resp.AddAttribute("nomad.version", req.Config.Version.VersionNumber())
resp.AddAttribute("nomad.revision", req.Config.Version.Revision)
resp.Applicable = true
return nil
}