mirror of https://github.com/docker/docs.git
Address review comments.
Thanks @mtrmac! Signed-off-by: Ying Li <ying.li@docker.com>
This commit is contained in:
parent
b4fb4ac173
commit
bd84f3cce1
|
@ -297,8 +297,8 @@ func validateRoot(gun string, oldRoot, newRoot []byte, store storage.MetaStore)
|
|||
return parsedNewRoot, nil
|
||||
}
|
||||
|
||||
// checkRoot errors if an invalid valid rotation has taken place, if the
|
||||
// threshold number of signatures is invalid valid, if there are an invalid
|
||||
// checkRoot errors if an invalid rotation has taken place, if the
|
||||
// threshold number of signatures is invalid, if there are an invalid
|
||||
// number of roles and keys, or if the timestamp keys are invalid
|
||||
func checkRoot(oldRoot, newRoot *data.SignedRoot, timestampKey data.PublicKey) error {
|
||||
rootRole := data.RoleName(data.CanonicalRootRole)
|
||||
|
|
|
@ -84,14 +84,16 @@ func NewHTTPStore(baseURL, metaPrefix, metaExtension, targetsPrefix, keyExtensio
|
|||
}
|
||||
|
||||
func translateStatusToError(resp *http.Response) error {
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
switch resp.StatusCode {
|
||||
case http.StatusOK:
|
||||
return nil
|
||||
case http.StatusNotFound:
|
||||
return ErrMetaNotFound{}
|
||||
} else if resp.StatusCode == http.StatusBadRequest {
|
||||
case http.StatusBadRequest:
|
||||
return ErrInvalidOperation{}
|
||||
} else if resp.StatusCode != http.StatusOK {
|
||||
default:
|
||||
return ErrServerUnavailable{code: resp.StatusCode}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMeta downloads the named meta file with the given size. A short body
|
||||
|
|
Loading…
Reference in New Issue