Skip to content

Commit

Permalink
Fix nil reference for empty cloud name
Browse files Browse the repository at this point in the history
  • Loading branch information
outcatcher committed Mar 27, 2020
1 parent a78bc54 commit 863a687
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions driver/services/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,19 @@ func (c *Client) Authenticate(opts *clientconfig.ClientOpts) error {
}

// mimic behaviour of OTC terraform provider
cloud, _ := clientconfig.GetCloudFromYAML(opts)
if ao.DomainID == "" {
ao.DomainID = cloud.AuthInfo.ProjectDomainID
}
if ao.DomainName == "" {
ao.DomainName = cloud.AuthInfo.ProjectDomainName
if opts.Cloud != "" {
cloud, _ := clientconfig.GetCloudFromYAML(opts)
if ao.DomainID == "" {
ao.DomainID = cloud.AuthInfo.ProjectDomainID
}
if ao.DomainName == "" {
ao.DomainName = cloud.AuthInfo.ProjectDomainName
}
if cloud.RegionName == "" {
cloud.RegionName = defaultRegion
}
c.endpointType = getEndpointType(cloud.EndpointType)
c.region = cloud.RegionName
}

userAgent := fmt.Sprintf("docker-machine/v%d", version.APIVersion)
Expand All @@ -99,11 +106,6 @@ func (c *Client) Authenticate(opts *clientconfig.ClientOpts) error {
}
c.Provider = authClient
c.Provider.UserAgent.Prepend(userAgent)
if cloud.RegionName == "" {
cloud.RegionName = defaultRegion
}
c.endpointType = getEndpointType(cloud.EndpointType)
c.region = cloud.RegionName
return nil
}

Expand Down

0 comments on commit 863a687

Please sign in to comment.