2015-08-20 23:29:19 +00:00
|
|
|
package fingerprint
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"runtime"
|
|
|
|
|
2015-08-25 23:21:29 +00:00
|
|
|
client "github.com/hashicorp/nomad/client/config"
|
2015-08-20 23:29:19 +00:00
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ArchFingerprint is used to fingerprint the architecture
|
|
|
|
type ArchFingerprint struct {
|
2015-11-05 21:46:02 +00:00
|
|
|
StaticFingerprinter
|
2015-08-20 23:29:19 +00:00
|
|
|
logger *log.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewArchFingerprint is used to create an OS fingerprint
|
|
|
|
func NewArchFingerprint(logger *log.Logger) Fingerprint {
|
2015-08-27 00:16:34 +00:00
|
|
|
f := &ArchFingerprint{logger: logger}
|
2015-08-20 23:29:19 +00:00
|
|
|
return f
|
|
|
|
}
|
|
|
|
|
2015-08-25 23:21:29 +00:00
|
|
|
func (f *ArchFingerprint) Fingerprint(config *client.Config, node *structs.Node) (bool, error) {
|
2015-08-20 23:29:19 +00:00
|
|
|
node.Attributes["arch"] = runtime.GOARCH
|
|
|
|
return true, nil
|
|
|
|
}
|