mirror of https://github.com/docker/compose.git
Fix `docker context ls` that was not displaying legacy context endpoints
This commit is contained in:
parent
667cdfcbf8
commit
d0b2bfbf52
|
@ -94,7 +94,7 @@ func getEndpoint(name string, meta map[string]interface{}) string {
|
||||||
if !ok {
|
if !ok {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
data, ok := endpoints.(store.Endpoint)
|
data, ok := endpoints.(*store.Endpoint)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,12 +211,14 @@ func toTypedEndpoints(endpoints map[string]interface{}) (map[string]interface{},
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
typeGetters := getters()
|
typeGetters := getters()
|
||||||
if _, ok := typeGetters[k]; !ok {
|
typeGetter, ok := typeGetters[k];
|
||||||
result[k] = v
|
if !ok {
|
||||||
continue
|
typeGetter = func() interface{} {
|
||||||
|
return &Endpoint{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val := typeGetters[k]()
|
val := typeGetter()
|
||||||
err = json.Unmarshal(bytes, &val)
|
err = json.Unmarshal(bytes, &val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -58,10 +58,10 @@ func dockerDefaultContext() (*DockerContext, error) {
|
||||||
meta := DockerContext{
|
meta := DockerContext{
|
||||||
Name: "default",
|
Name: "default",
|
||||||
Endpoints: map[string]interface{}{
|
Endpoints: map[string]interface{}{
|
||||||
"docker": Endpoint{
|
"docker": &Endpoint{
|
||||||
Host: defaultCtx.Endpoints.Docker.Host,
|
Host: defaultCtx.Endpoints.Docker.Host,
|
||||||
},
|
},
|
||||||
"kubernetes": Endpoint{
|
"kubernetes": &Endpoint{
|
||||||
Host: defaultCtx.Endpoints.Kubernetes.Host,
|
Host: defaultCtx.Endpoints.Kubernetes.Host,
|
||||||
DefaultNamespace: defaultCtx.Endpoints.Kubernetes.DefaultNamespace,
|
DefaultNamespace: defaultCtx.Endpoints.Kubernetes.DefaultNamespace,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue