mirror of
https://github.com/containers/skopeo.git
synced 2025-07-03 09:56:57 +00:00
Merge pull request #262 from runcom/fix-quay-io
docker: fix ping routine
This commit is contained in:
commit
fb61d0c98f
17
vendor/github.com/containers/image/docker/docker_client.go
generated
vendored
17
vendor/github.com/containers/image/docker/docker_client.go
generated
vendored
@ -342,17 +342,10 @@ func getAuth(ctx *types.SystemContext, registry string) (string, string, error)
|
|||||||
return "", "", nil
|
return "", "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type apiErr struct {
|
|
||||||
Code string
|
|
||||||
Message string
|
|
||||||
Detail interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
type pingResponse struct {
|
type pingResponse struct {
|
||||||
WWWAuthenticate string
|
WWWAuthenticate string
|
||||||
APIVersion string
|
APIVersion string
|
||||||
scheme string
|
scheme string
|
||||||
errors []apiErr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *dockerClient) ping() (*pingResponse, error) {
|
func (c *dockerClient) ping() (*pingResponse, error) {
|
||||||
@ -372,16 +365,6 @@ func (c *dockerClient) ping() (*pingResponse, error) {
|
|||||||
pr.WWWAuthenticate = resp.Header.Get("WWW-Authenticate")
|
pr.WWWAuthenticate = resp.Header.Get("WWW-Authenticate")
|
||||||
pr.APIVersion = resp.Header.Get("Docker-Distribution-Api-Version")
|
pr.APIVersion = resp.Header.Get("Docker-Distribution-Api-Version")
|
||||||
pr.scheme = scheme
|
pr.scheme = scheme
|
||||||
if resp.StatusCode == http.StatusUnauthorized {
|
|
||||||
type APIErrors struct {
|
|
||||||
Errors []apiErr
|
|
||||||
}
|
|
||||||
errs := &APIErrors{}
|
|
||||||
if err := json.NewDecoder(resp.Body).Decode(errs); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
pr.errors = errs.Errors
|
|
||||||
}
|
|
||||||
return pr, nil
|
return pr, nil
|
||||||
}
|
}
|
||||||
pr, err := ping("https")
|
pr, err := ping("https")
|
||||||
|
Loading…
Reference in New Issue
Block a user