2016-03-23 00:12:30 +00:00
|
|
|
package fingerprint
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
client "github.com/hashicorp/nomad/client/config"
|
|
|
|
"github.com/hashicorp/nomad/nomad/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(config *client.Config, node *structs.Node) (bool, error) {
|
2017-08-16 22:42:15 +00:00
|
|
|
node.Attributes["nomad.version"] = config.Version.VersionNumber()
|
|
|
|
node.Attributes["nomad.revision"] = config.Version.Revision
|
2016-03-23 00:12:30 +00:00
|
|
|
return true, nil
|
|
|
|
}
|