github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/client/fingerprint/nomad.go (about)

     1  package fingerprint
     2  
     3  import (
     4  	"log"
     5  
     6  	client "github.com/hashicorp/nomad/client/config"
     7  	"github.com/hashicorp/nomad/nomad/structs"
     8  )
     9  
    10  // NomadFingerprint is used to fingerprint the Nomad version
    11  type NomadFingerprint struct {
    12  	StaticFingerprinter
    13  	logger *log.Logger
    14  }
    15  
    16  // NewNomadFingerprint is used to create a Nomad fingerprint
    17  func NewNomadFingerprint(logger *log.Logger) Fingerprint {
    18  	f := &NomadFingerprint{logger: logger}
    19  	return f
    20  }
    21  
    22  func (f *NomadFingerprint) Fingerprint(config *client.Config, node *structs.Node) (bool, error) {
    23  	node.Attributes["nomad.version"] = config.Version
    24  	node.Attributes["nomad.revision"] = config.Revision
    25  	return true, nil
    26  }