Visitar URL original
auth: do not fall back to user_domain_*/project_domain_* in clouds.yaml parser by kayrus · Pull Request #4005 · gophercloud/gophercloud · GitHub
Skip to content

auth: do not fall back to user_domain_*/project_domain_* in clouds.yaml parser - #4005

Open
kayrus wants to merge 1 commit into
gophercloud:mainfrom
kayrus:adjust-clouds-parser
Open

kayrus wants to merge 1 commit into
gophercloud:mainfrom
kayrus:adjust-clouds-parser

Conversation

@kayrus

@kayrus kayrus commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

The clouds.yaml parser previously coalesced the user identity domain from user_domain_id/user_domain_name and the project scope domain from domain_id/domain_name. Those fallbacks are removed:

  • AuthOptions.DomainID/DomainName now come only from domain_id/domain_name.
  • The project-scope domain now comes only from project_domain_id/ project_domain_name.

Callers must specify the user and project domains explicitly. Tests updated to reflect the new behavior.

Followup for the #3739 PR

…ml parser

The clouds.yaml parser previously coalesced the user identity domain from
user_domain_id/user_domain_name and the project scope domain from
domain_id/domain_name. Those fallbacks are removed:

- AuthOptions.DomainID/DomainName now come only from domain_id/domain_name.
- The project-scope domain now comes only from project_domain_id/
  project_domain_name.

Callers must specify the user and project domains explicitly. Tests updated
to reflect the new behavior.
@github-actions github-actions Bot added edit:config This PR updates config code semver:patch No API change backport-v2 This PR will be backported to v2 labels Sep 7, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 63.583% (-0.005%) from 63.588% — kayrus:adjust-clouds-parser into gophercloud:main

@kayrus
kayrus requested review from mandre and stephenfin September 7, 2026 17:34
cloud: gophercloud-test-1
auth:
user_domain_name: CustomDomain`
domain_name: CustomDomain`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a small nitpick, the other clouds.yaml should also have domain_name as to not be confusing to the reader

cloud: gophercloud-test-1
auth:
user_domain_name: CustomDomain`
domain_name: CustomDomain`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment at line 320 above

if err != nil {
t.Fatalf("unexpected error: %v", err)
}
th.AssertNoErr(t, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nitpick: user_domain_name is stale and no longer needed in example clouds.yaml

if err != nil {
t.Fatalf("unexpected error: %v", err)
}
th.AssertNoErr(t, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for clarity, I would remove user_domain_name and use Default as the value for domain_name

th.AssertEquals(t, "ProjectDomain", ao.Scope.DomainName)
})

t.Run("domain scoping with user_domain_id and domain_id", func(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name this test domain scoping with domain_id and remove user_domain_id from cloud.yaml to be more clear on the intent of the test

})

t.Run("user_domain_name takes precedence over domain_name for user identity", func(t *testing.T) {
t.Run("domain_name sets user identity and user_domain_name is not used", func(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this test doesn't concern scope, we should remove th.AssertEquals(t, "", ao.Scope.DomainName), and for clarity, I would change the name of the domain_name to domain or something like that (no longer a fallback)

@danchild

Copy link
Copy Markdown
Contributor

@kayrus the patch looks good to me. As noted in my comments, the only things I would change concern making sure that the intent of the tests are clear for future readers. All nitpicks

@mandre mandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for a few fields is now inaccurate in types.go. We should fix it before merging the PR.
Also, it seems like UserDomainName and UserDomainID are now completely ignored, we should drop them, or at least mark them as deprecated/unused if we want to avoid breaking backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v2 This PR will be backported to v2 edit:config This PR updates config code semver:patch No API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants