update vendored go-checkpoint

This commit is contained in:
Matthias Radestock
2016-03-11 11:12:54 +00:00
parent b2c0c93d5e
commit c6bd583a35
2 changed files with 19 additions and 14 deletions

View File

@@ -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
View File

@@ -803,7 +803,7 @@
{
"importpath": "github.com/weaveworks/go-checkpoint",
"repository": "https://github.com/weaveworks/go-checkpoint",
"revision": "a235d5b1d2bd7be80fa52ff681f6d6baa933f635",
"revision": "d99cc14f13e7845b370a7dc81d47cafb29cdc97f",
"branch": "master"
},
{