mirror of
https://github.com/containers/skopeo.git
synced 2025-09-14 05:50:56 +00:00
docker: fix ping routine
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
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")
|
||||||
|
Reference in New Issue
Block a user