github.com/bigcommerce/nomad@v0.9.3-bc/client/fingerprint/signal.go (about) 1 package fingerprint 2 3 import ( 4 "strings" 5 6 "github.com/hashicorp/consul-template/signals" 7 log "github.com/hashicorp/go-hclog" 8 ) 9 10 // SignalFingerprint is used to fingerprint the available signals 11 type SignalFingerprint struct { 12 StaticFingerprinter 13 logger log.Logger 14 } 15 16 // NewSignalFingerprint is used to create a Signal fingerprint 17 func NewSignalFingerprint(logger log.Logger) Fingerprint { 18 f := &SignalFingerprint{logger: logger.Named("signals")} 19 return f 20 } 21 22 func (f *SignalFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error { 23 // Build the list of available signals 24 sigs := make([]string, 0, len(signals.SignalLookup)) 25 for signal := range signals.SignalLookup { 26 sigs = append(sigs, signal) 27 } 28 29 resp.AddAttribute("os.signals", strings.Join(sigs, ",")) 30 resp.Detected = true 31 return nil 32 }