Merge pull request #4270 from DevTable/fixregistryauth
Fix registry auth and remove other hidden ping commands from client code
This commit is contained in:
commit
1278e74c26
@ -92,7 +92,7 @@ func validateRepositoryName(repositoryName string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolves a repository name to a endpoint + name
|
// Resolves a repository name to a hostname + name
|
||||||
func ResolveRepositoryName(reposName string) (string, string, error) {
|
func ResolveRepositoryName(reposName string) (string, string, error) {
|
||||||
if strings.Contains(reposName, "://") {
|
if strings.Contains(reposName, "://") {
|
||||||
// It cannot contain a scheme!
|
// It cannot contain a scheme!
|
||||||
@ -118,11 +118,8 @@ func ResolveRepositoryName(reposName string) (string, string, error) {
|
|||||||
if err := validateRepositoryName(reposName); err != nil {
|
if err := validateRepositoryName(reposName); err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
endpoint, err := ExpandAndVerifyRegistryUrl(hostname)
|
|
||||||
if err != nil {
|
return hostname, reposName, nil
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
return endpoint, reposName, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this method expands the registry name as used in the prefix of a repo
|
// this method expands the registry name as used in the prefix of a repo
|
||||||
|
@ -145,7 +145,7 @@ func TestResolveRepositoryName(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
assertEqual(t, ep, "http://"+u+"/v1/", "Expected endpoint to be "+u)
|
assertEqual(t, ep, u, "Expected endpoint to be "+u)
|
||||||
assertEqual(t, repo, "private/moonbase", "Expected endpoint to be private/moonbase")
|
assertEqual(t, repo, "private/moonbase", "Expected endpoint to be private/moonbase")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user