mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
update vendored go-checkpoint
This commit is contained in:
31
vendor/github.com/weaveworks/go-checkpoint/checkpoint.go
generated
vendored
31
vendor/github.com/weaveworks/go-checkpoint/checkpoint.go
generated
vendored
@@ -118,18 +118,19 @@ func Check(p *CheckParams) (*CheckResponse, error) {
|
||||
p.OS = runtime.GOOS
|
||||
}
|
||||
|
||||
// If we're not given a Signature, then attempt to read one.
|
||||
signature := p.Signature
|
||||
if p.Signature == "" {
|
||||
var err error
|
||||
if p.SignatureFile == "" {
|
||||
signature, err = getSystemUUID()
|
||||
} else {
|
||||
signature, err = checkSignature(p.SignatureFile)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// If we're not given a Signature, then attempt to read one from a
|
||||
// file, if specified, or derive it from the system uuid.
|
||||
//
|
||||
// NB: We ignore errors here since it is better to perform the
|
||||
// check with an empty signature than not at all.
|
||||
var signature string
|
||||
switch {
|
||||
case p.Signature != "":
|
||||
signature = p.Signature
|
||||
case p.SignatureFile != "":
|
||||
signature, _ = checkSignature(p.SignatureFile)
|
||||
default:
|
||||
signature, _ = getSystemUUID()
|
||||
}
|
||||
|
||||
v := u.Query()
|
||||
@@ -293,9 +294,13 @@ func checkResult(r io.Reader) (*CheckResponse, error) {
|
||||
}
|
||||
|
||||
// getSystemUUID returns the base64 encoded, scrypt hashed contents of
|
||||
// /sys/class/dmi/id/product_uuid.
|
||||
// /sys/class/dmi/id/product_uuid, or, if that is not available,
|
||||
// sys/hypervisor/uuid.
|
||||
func getSystemUUID() (string, error) {
|
||||
uuid, err := ioutil.ReadFile("/sys/class/dmi/id/product_uuid")
|
||||
if os.IsNotExist(err) {
|
||||
uuid, err = ioutil.ReadFile("/sys/hypervisor/uuid")
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@@ -803,7 +803,7 @@
|
||||
{
|
||||
"importpath": "github.com/weaveworks/go-checkpoint",
|
||||
"repository": "https://github.com/weaveworks/go-checkpoint",
|
||||
"revision": "a235d5b1d2bd7be80fa52ff681f6d6baa933f635",
|
||||
"revision": "d99cc14f13e7845b370a7dc81d47cafb29cdc97f",
|
||||
"branch": "master"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user