Skip to content

Commit

Permalink
Merge pull request #923 from docker/purge-autopublish
Browse files Browse the repository at this point in the history
add auto-publish to purge
  • Loading branch information
riyazdf authored Aug 17, 2016
2 parents 0e7a304 + a172683 commit 0c7ed78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cmd/notary/delegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (d *delegationCommander) GetCommand() *cobra.Command {

cmdPurgeDelgKeys := cmdDelegationPurgeKeysTemplate.ToCommand(d.delegationPurgeKeys)
cmdPurgeDelgKeys.Flags().StringSliceVar(&d.keyIDs, "key", nil, "Delegation key IDs to be removed from the GUN")
cmdPurgeDelgKeys.Flags().BoolVarP(&d.autoPublish, "publish", "p", false, htAutoPublish)
cmd.AddCommand(cmdPurgeDelgKeys)

cmdRemDelg := cmdDelegationRemoveTemplate.ToCommand(d.delegationRemove)
Expand Down Expand Up @@ -166,7 +167,7 @@ func (d *delegationCommander) delegationsList(cmd *cobra.Command, args []string)
cmd.Println("")
prettyPrintRoles(delegationRoles, cmd.Out(), "delegations")
cmd.Println("")
return nil
return maybeAutoPublish(cmd, d.autoPublish, gun, config, d.retriever)
}

// delegationRemove removes a public key from a specific role in a GUN
Expand Down
7 changes: 2 additions & 5 deletions cmd/notary/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1450,11 +1450,8 @@ func TestPurge(t *testing.T) {
err = os.Remove(filepath.Join(tempDir, notary.PrivDir, notary.NonRootKeysSubdir, "gun", targetsKeyID+".key"))
require.NoError(t, err)

_, err = runCommand(t, tempDir, "delegation", "purge", "gun", "--key", keyID)
require.NoError(t, err)

// publish doesn't error because purge only updates the roles we have signing keys for
_, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun")
// auto-publish doesn't error because purge only updates the roles we have signing keys for
_, err = runCommand(t, tempDir, "delegation", "purge", "-s", server.URL, "-p", "gun", "--key", keyID)
require.NoError(t, err)

// check the delegation wasn't removed
Expand Down

0 comments on commit 0c7ed78

Please sign in to comment.