2016-03-23 00:12:30 +00:00
|
|
|
package fingerprint
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2018-01-24 14:09:53 +00:00
|
|
|
cstructs "github.com/hashicorp/nomad/client/structs"
|
2016-03-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2018-01-24 14:09:53 +00:00
|
|
|
func (f *NomadFingerprint) Fingerprint(req *cstructs.FingerprintRequest, resp *cstructs.FingerprintResponse) error {
|
2018-01-26 16:21:07 +00:00
|
|
|
resp.AddAttribute("nomad.version", req.Config.Version.VersionNumber())
|
|
|
|
resp.AddAttribute("nomad.revision", req.Config.Version.Revision)
|
2018-01-31 22:03:55 +00:00
|
|
|
resp.Detected = true
|
2018-01-24 14:09:53 +00:00
|
|
|
return nil
|
2016-03-23 00:12:30 +00:00
|
|
|
}
|