Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/v1.4] Openstack: Tenant ID/Name is not required with application credentials #2201

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ issues:
text: "`registry` always receives `\"127.0.0.1:5000\"`"

- path: pkg/credentials
text: "cyclomatic complexity 34 of func `openstackValidationFunc` is high"
text: "cyclomatic complexity 36 of func `openstackValidationFunc` is high"

- path: pkg/addons
text: "cyclomatic complexity 34 of func `newAddonsApplier` is high"
9 changes: 6 additions & 3 deletions pkg/credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,12 @@ func openstackValidationFunc(creds map[string]string) error {
return errors.New("no valid credentials (either application or user) found")
}

if v, ok := creds[OpenStackTenantID]; !ok || len(v) == 0 {
if v, ok := creds[OpenStackTenantName]; !ok || len(v) == 0 {
return errors.Errorf("key %v or %v is required but isn't present", OpenStackTenantID, OpenStackTenantName)
// Tenant ID/Name are not required when using application credentials.
if userCredsUsernameOkay && userCredsPasswordOkay {
if v, ok := creds[OpenStackTenantID]; !ok || len(v) == 0 {
if v, ok := creds[OpenStackTenantName]; !ok || len(v) == 0 {
return errors.Errorf("key %v or %v is required but isn't present", OpenStackTenantID, OpenStackTenantName)
}
}
}

Expand Down