github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/client/fingerprint/signal.go (about) 1 package fingerprint 2 3 import ( 4 "log" 5 "strings" 6 7 "github.com/hashicorp/consul-template/signals" 8 "github.com/hashicorp/nomad/client/config" 9 "github.com/hashicorp/nomad/nomad/structs" 10 ) 11 12 // SignalFingerprint is used to fingerprint the available signals 13 type SignalFingerprint struct { 14 StaticFingerprinter 15 logger *log.Logger 16 } 17 18 // NewSignalFingerprint is used to create a Signal fingerprint 19 func NewSignalFingerprint(logger *log.Logger) Fingerprint { 20 f := &SignalFingerprint{logger: logger} 21 return f 22 } 23 24 func (f *SignalFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error) { 25 // Build the list of available signals 26 sigs := make([]string, 0, len(signals.SignalLookup)) 27 for signal := range signals.SignalLookup { 28 sigs = append(sigs, signal) 29 } 30 31 node.Attributes["os.signals"] = strings.Join(sigs, ",") 32 return true, nil 33 }