Skip to content

Commit

Permalink
Improve error message when default signing key is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritesh Bandi committed Nov 4, 2022
1 parent ed5beb8 commit a71b7d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Binary file added cmd/notation/notation
Binary file not shown.
9 changes: 9 additions & 0 deletions pkg/configutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ func ResolveKey(name string) (config.KeySuite, error) {
if err != nil {
return config.KeySuite{}, err
}

// if name is empty, look for default signing key
if name == "" {
name = signingKeys.Default
}

// if name is still empty, return error
if name == "" {
return config.KeySuite{}, errors.New("default signing key not set." +
" Please set default singing key or specify a key name")
}

idx := slices.Index(signingKeys.Keys, name)
if idx < 0 {
return config.KeySuite{}, ErrKeyNotFound
Expand Down

0 comments on commit a71b7d0

Please sign in to comment.