mirror of https://github.com/docker/docs.git
Merge pull request #442 from endophage/rotate_key_not_read_only
when doing getTransport readOnly needs to be false
This commit is contained in:
commit
b6042d923f
|
@ -371,7 +371,7 @@ func (k *keyCommander) keysRotate(cmd *cobra.Command, args []string) error {
|
|||
if k.rotateKeyServerManaged {
|
||||
// this does not actually push the changes, just creates the keys, but
|
||||
// it creates a key remotely so it needs a transport
|
||||
rt = getTransport(config, gun, true)
|
||||
rt = getTransport(config, gun, false)
|
||||
}
|
||||
nRepo, err := notaryclient.NewNotaryRepository(
|
||||
config.GetString("trust_dir"), gun, getRemoteTrustServer(config),
|
||||
|
|
|
@ -354,6 +354,13 @@ func (ps passwordStore) Basic(u *url.URL) (string, string) {
|
|||
return username, password
|
||||
}
|
||||
|
||||
// getTransport returns an http.RoundTripper to be used for all http requests.
|
||||
// It correctly handles the auth challenge/credentials required to interact
|
||||
// with a notary server over both HTTP Basic Auth and the JWT auth implemented
|
||||
// in the notary-server
|
||||
// The readOnly flag indicates if the operation should be performed as an
|
||||
// anonymous read only operation. If the command entered requires write
|
||||
// permissions on the server, readOnly must be false
|
||||
func getTransport(config *viper.Viper, gun string, readOnly bool) http.RoundTripper {
|
||||
// Attempt to get a root CA from the config file. Nil is the host defaults.
|
||||
rootCAFile := config.GetString("remote_server.root_ca")
|
||||
|
|
Loading…
Reference in New Issue