Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 37123d6

Browse files
committed
Merge pull request #552 from jrperritt/scope-reauth-fix
leave auth options untouched in authv3
2 parents 61270d4 + 69cc337 commit 37123d6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

openstack/client.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,29 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, options gopherc
134134
v3Client.Endpoint = endpoint
135135
}
136136

137+
// copy the auth options to a local variable that we can change. `options`
138+
// needs to stay as-is for reauth purposes
139+
v3Options := options
140+
137141
var scope *tokens3.Scope
138142
if options.TenantID != "" {
139143
scope = &tokens3.Scope{
140144
ProjectID: options.TenantID,
141145
}
142-
options.TenantID = ""
143-
options.TenantName = ""
146+
v3Options.TenantID = ""
147+
v3Options.TenantName = ""
144148
} else {
145149
if options.TenantName != "" {
146150
scope = &tokens3.Scope{
147151
ProjectName: options.TenantName,
148152
DomainID: options.DomainID,
149153
DomainName: options.DomainName,
150154
}
151-
options.TenantName = ""
155+
v3Options.TenantName = ""
152156
}
153157
}
154158

155-
result := tokens3.Create(v3Client, options, scope)
159+
result := tokens3.Create(v3Client, v3Options, scope)
156160

157161
token, err := result.ExtractToken()
158162
if err != nil {

0 commit comments

Comments
 (0)