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

CSS-9588 Enforce stricter model name uniqueness #1272

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Jul 16, 2024

Description

This PR resolves an issue where a user could create a model with the same name on multiple controllers and because the model owner was the same across these models, Juju clients would behave poorly. The CLI for example would never let you switch between these two models with the same name and owner.

This behaviour is better as it matches Juju's behaviour.

Fixes CSS-9588

Engineering checklist

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

@kian99 kian99 requested a review from a team as a code owner July 16, 2024 12:59
@kian99 kian99 force-pushed the CSS-9588-model-name-changes branch from 379d1b2 to 03107b0 Compare July 16, 2024 14:28
@kian99 kian99 mentioned this pull request Jul 16, 2024
3 tasks
internal/dbmodel/model_test.go Show resolved Hide resolved
Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

lgtm but can we surface a nice error for this in the addmodel call? Like check for this db err and return a nicer string to the user?

@kian99
Copy link
Contributor Author

kian99 commented Jul 17, 2024

@ale8k

lgtm but can we surface a nice error for this in the addmodel call? Like check for this db err and return a nicer string to the user?

The error returned is shown in the test added to jujuapi -

model bob@canonical.com/my-model already exists (already exists)

Did you want something different from that?

@ale8k
Copy link
Contributor

ale8k commented Jul 17, 2024

@ale8k

lgtm but can we surface a nice error for this in the addmodel call? Like check for this db err and return a nicer string to the user?

The error returned is shown in the test added to jujuapi -

model bob@canonical.com/my-model already exists (already exists)

Did you want something different from that?

Yeah something like uhhhhm, I'm bad at this but try word this better:

model X already exists on controller N

I think telling the user what controller it's on is actually kinda useful? Or maybe it isn't... Idk in my head it felt nice

@kian99
Copy link
Contributor Author

kian99 commented Jul 17, 2024

I think telling the user what controller it's on is actually kinda useful? Or maybe it isn't... Idk in my head it felt nice

It's a nice idea, but I think it's preferable to not expose that information since JIMM wants to act as a single controller.

@kian99 kian99 merged commit cf66159 into canonical:v3 Jul 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants