Address review comments.

Thanks @mtrmac!

Signed-off-by: Ying Li <ying.li@docker.com>
This commit is contained in:
Ying Li 2015-11-24 13:45:02 -05:00
parent b4fb4ac173
commit bd84f3cce1
2 changed files with 8 additions and 6 deletions

View File

@ -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)

View File

@ -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