1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Updating header name and executor

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
Nishant Totla 2016-06-16 19:09:44 -07:00
parent e13a14340d
commit af5df117a8
No known key found for this signature in database
GPG key ID: 7EA5781C9B3D0C19
7 changed files with 10 additions and 18 deletions

View file

@ -47,7 +47,7 @@ func runCreate(dockerCli *client.DockerCli, opts *serviceOptions) error {
}
headers := map[string][]string{
"x-registry-auth": {encodedAuth},
"X-Registry-Auth": {encodedAuth},
}
response, err := apiClient.ServiceCreate(ctx, service, headers)

View file

@ -76,9 +76,7 @@ func runServiceScale(dockerCli *client.DockerCli, serviceID string, scale string
if err != nil {
return err
}
headers = map[string][]string{
"x-registry-auth": {encodedAuth},
}
headers["X-Registry-Auth"] = []string{encodedAuth}
}
serviceMode := &service.Spec.Mode

View file

@ -53,9 +53,7 @@ func runUpdate(dockerCli *client.DockerCli, flags *pflag.FlagSet, serviceID stri
if err != nil {
return err
}
headers = map[string][]string{
"x-registry-auth": {encodedAuth},
}
headers["X-Registry-Auth"] = []string{encodedAuth}
}
service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID)

View file

@ -184,18 +184,21 @@ func deployServices(
if service, exists := existingServiceMap[name]; exists {
fmt.Fprintf(out, "Updating service %s (id: %s)\n", name, service.ID)
// TODO(nishanttotla): Pass headers with X-Registry-Auth
if err := apiClient.ServiceUpdate(
ctx,
service.ID,
service.Version,
serviceSpec,
nil,
); err != nil {
return err
}
} else {
fmt.Fprintf(out, "Creating service %s\n", name)
if _, err := apiClient.ServiceCreate(ctx, serviceSpec); err != nil {
// TODO(nishanttotla): Pass headers with X-Registry-Auth
if _, err := apiClient.ServiceCreate(ctx, serviceSpec, nil); err != nil {
return err
}
}

View file

@ -107,10 +107,7 @@ func (sr *swarmRouter) createService(ctx context.Context, w http.ResponseWriter,
return err
}
encodedAuth := ""
if auth, ok := r.Header["x-registry-auth"]; ok {
encodedAuth = auth[0]
}
encodedAuth := r.Header.Get("X-Registry-Auth")
id, err := sr.backend.CreateService(service, encodedAuth)
if err != nil {
@ -135,10 +132,7 @@ func (sr *swarmRouter) updateService(ctx context.Context, w http.ResponseWriter,
return fmt.Errorf("Invalid service version '%s': %s", rawVersion, err.Error())
}
encodedAuth := ""
if auth, ok := r.Header["x-registry-auth"]; ok {
encodedAuth = auth[0]
}
encodedAuth := r.Header.Get("X-Registry-Auth")
if err := sr.backend.UpdateService(vars["id"], version, service, encodedAuth); err != nil {
logrus.Errorf("Error updating service %s: %v", vars["id"], err)

View file

@ -44,7 +44,6 @@ func (c *containerAdapter) pullImage(ctx context.Context) error {
var encodedAuthConfig string
if spec.PullOptions != nil {
encodedAuthConfig = spec.PullOptions.RegistryAuth
}
authConfig := &types.AuthConfig{}

View file

@ -60,7 +60,7 @@ clone git golang.org/x/net 2beffdc2e92c8a3027590f898fe88f69af48a3f8 https://gith
clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git
clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
clone git github.com/docker/go-connections fa2850ff103453a9ad190da0df0af134f0314b3d
clone git github.com/docker/engine-api c57d0447ea1ae71f6dad83c8d8a1215a89869a0c
clone git github.com/docker/engine-api 19b4fb48a86c3318e610e156ec06b684f79ac31d
clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
clone git github.com/imdario/mergo 0.2.1