open-nomad/client/fingerprint/arch.go

27 lines
648 B
Go
Raw Normal View History

2015-08-20 23:29:19 +00:00
package fingerprint
import (
"runtime"
log "github.com/hashicorp/go-hclog"
cstructs "github.com/hashicorp/nomad/client/structs"
2015-08-20 23:29:19 +00:00
)
// ArchFingerprint is used to fingerprint the architecture
type ArchFingerprint struct {
2015-11-05 21:46:02 +00:00
StaticFingerprinter
logger log.Logger
2015-08-20 23:29:19 +00:00
}
// NewArchFingerprint is used to create an OS fingerprint
func NewArchFingerprint(logger log.Logger) Fingerprint {
f := &ArchFingerprint{logger: logger.Named("arch")}
2015-08-20 23:29:19 +00:00
return f
}
func (f *ArchFingerprint) Fingerprint(req *cstructs.FingerprintRequest, resp *cstructs.FingerprintResponse) error {
resp.AddAttribute("cpu.arch", runtime.GOARCH)
2018-01-31 22:03:55 +00:00
resp.Detected = true
return nil
2015-08-20 23:29:19 +00:00
}