Skip to content

Commit

Permalink
installer: improve incompatible image error message
Browse files Browse the repository at this point in the history
Include image device types and own device type in an error thrown when image is
incompatible with the device.

Changelog: title

Signed-off-by: Maciej Borzecki <[email protected]>
(cherry picked from commit 496099b)
  • Loading branch information
bboozzoo authored and kacf committed Aug 18, 2017
1 parent 1128c3c commit 64e0a00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func Install(art io.ReadCloser, dt string, key []byte, device UInstaller) error
return nil
}
}
return errors.New("installer: image not compatible with device")
return errors.Errorf("installer: image (device types %v) not compatible with device %v",
devices, dt)
}

// VerifySignatureCallback needs to be registered both for
Expand Down
4 changes: 2 additions & 2 deletions installer/installer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestInstall(t *testing.T) {
err = Install(art, "fake-device", nil, nil)
assert.Error(t, err)
assert.Contains(t, errors.Cause(err).Error(),
"image not compatible with device")
"not compatible with device fake-device")

art, err = MakeRootfsImageArtifact(1, false)
assert.NoError(t, err)
Expand All @@ -62,7 +62,7 @@ func TestInstallSigned(t *testing.T) {
err = Install(art, "fake-device", []byte(PublicRSAKey), new(fDevice))
assert.Error(t, err)
assert.Contains(t, errors.Cause(err).Error(),
"image not compatible with device")
"not compatible with device fake-device")

// installation successful
art, err = MakeRootfsImageArtifact(2, true)
Expand Down

0 comments on commit 64e0a00

Please sign in to comment.