registry: getting Endpoint ironned out
Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
parent
48b43c2645
commit
d629bebce2
6 changed files with 177 additions and 103 deletions
|
@ -40,11 +40,14 @@ func (s *Service) Auth(job *engine.Job) engine.Status {
|
|||
job.GetenvJson("authConfig", authConfig)
|
||||
// TODO: this is only done here because auth and registry need to be merged into one pkg
|
||||
if addr := authConfig.ServerAddress; addr != "" && addr != IndexServerAddress() {
|
||||
addr, err = ExpandAndVerifyRegistryUrl(addr)
|
||||
endpoint, err := NewEndpoint(addr)
|
||||
if err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
authConfig.ServerAddress = addr
|
||||
if _, err := endpoint.Ping(); err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
authConfig.ServerAddress = endpoint.String()
|
||||
}
|
||||
status, err := Login(authConfig, HTTPRequestFactory(nil))
|
||||
if err != nil {
|
||||
|
@ -86,11 +89,11 @@ func (s *Service) Search(job *engine.Job) engine.Status {
|
|||
if err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
hostname, err = ExpandAndVerifyRegistryUrl(hostname)
|
||||
endpoint, err := NewEndpoint(hostname)
|
||||
if err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
r, err := NewSession(authConfig, HTTPRequestFactory(metaHeaders), hostname, true)
|
||||
r, err := NewSession(authConfig, HTTPRequestFactory(metaHeaders), endpoint, true)
|
||||
if err != nil {
|
||||
return job.Error(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue