Skip to content

Commit

Permalink
Update comments, and publish in the CLI after remote key rotation
Browse files Browse the repository at this point in the history
Signed-off-by: Ying Li <ying.li@docker.com>
  • Loading branch information
cyli committed Feb 17, 2016
1 parent e61fc7f commit 815981f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ func TestRotateKeyInvalidRole(t *testing.T) {
repo, _ := initializeRepo(t, data.ECDSAKey, "docker.com/notary", ts.URL, false)
defer os.RemoveAll(repo.baseDir)

// the equivalent of: remotely remotely rotating the root key
// the equivalent of: remotely rotating the root key
// (RotateKey("root", true)), locally rotating the root key (RotateKey("root", false)),
// locally rotating the timestamp key (RotateKey("timestamp", false)),
// and remotely rotating the targets key (RotateKey(targets, true)), all of which should
Expand Down
6 changes: 5 additions & 1 deletion cmd/notary/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,11 @@ func (k *keyCommander) keysRotate(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
return nRepo.RotateKey(rotateKeyRole, k.rotateKeyServerManaged)
err = nRepo.RotateKey(rotateKeyRole, k.rotateKeyServerManaged)
if err == nil && k.rotateKeyServerManaged {
err = nRepo.Publish()
}
return err
}

func removeKeyInteractively(keyStores []trustmanager.KeyStore, keyID string,
Expand Down
4 changes: 1 addition & 3 deletions cmd/notary/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ func TestRotateKeyRemoteServerManagesKey(t *testing.T) {

cl, err := repo.GetChangelist()
assert.NoError(t, err, "unable to get changelist: %v", err)
assert.Len(t, cl.List(), 1, "expected a single key rotation change")

assert.NoError(t, repo.Publish())
assert.Len(t, cl.List(), 0, "expected the changes to have been published")

finalKeys := repo.CryptoService.ListAllKeys()
assert.Len(t, initialKeys, 3)
Expand Down

0 comments on commit 815981f

Please sign in to comment.