From 1dc73b0f754792c0cad2b983144a76fba6752193 Mon Sep 17 00:00:00 2001 From: Anton Kachurin Date: Fri, 27 Mar 2020 19:42:40 +0300 Subject: [PATCH] Fix authorization with raw credentials --- Makefile | 2 +- driver/opentelekomcloud.go | 1 - driver/services/client.go | 12 ++++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d4aecbc..3a04361 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ export PATH:=/usr/local/go/bin:$(PATH) exec_path := /usr/local/bin/ exec_name := docker-machine-driver-otc -VERSION := 0.2.1b1 +VERSION := 0.2.1b2 default: test build diff --git a/driver/opentelekomcloud.go b/driver/opentelekomcloud.go index f503d7b..241f09e 100644 --- a/driver/opentelekomcloud.go +++ b/driver/opentelekomcloud.go @@ -224,7 +224,6 @@ func (d *Driver) Authenticate() error { ProjectID: d.ProjectID, ProjectDomainName: d.DomainName, ProjectDomainID: d.DomainID, - DefaultDomain: d.DomainName, Token: d.Token, }, } diff --git a/driver/services/client.go b/driver/services/client.go index b839237..c1a1c27 100644 --- a/driver/services/client.go +++ b/driver/services/client.go @@ -85,6 +85,18 @@ func (c *Client) Authenticate(opts *clientconfig.ClientOpts) error { } c.endpointType = getEndpointType(cloud.EndpointType) c.region = cloud.RegionName + } else { + if ao.DomainID == "" { + ao.DomainID = opts.AuthInfo.ProjectDomainID + } + if ao.DomainName == "" { + ao.DomainName = opts.AuthInfo.ProjectDomainName + } + if opts.RegionName == "" { + opts.RegionName = defaultRegion + } + c.endpointType = getEndpointType(opts.EndpointType) + c.region = opts.RegionName } userAgent := fmt.Sprintf("docker-machine/v%d", version.APIVersion)