-
Notifications
You must be signed in to change notification settings - Fork 8
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-5266 - Tweak length check to require at least 1 region and controller #1034
Conversation
internal/jimm/cloud.go
Outdated
// Ensure we always have at least 1 region for the cloud with at least 1 controller | ||
// managing that region. | ||
if len(c.Regions) < 1 || len(c.Regions[0].Controllers) < 1 { | ||
zapctx.Error(ctx, "cloud regions check", zap.Int("regions", len(c.Regions))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is not clear enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more of a debug line actually, if I change it to Debug should I then leave it or make it more explanatory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although a clear message is good anyway, but if it's just for future debugging, leave it as is. Also, I'm not sure if changing the level to debug is going to help, because we may lose it due to the applied log-level config.
internal/jimm/cloud.go
Outdated
if len(c.Regions) < 1 || len(c.Regions[0].Controllers) < 1 { | ||
zapctx.Error(ctx, "cloud regions check", zap.Int("regions", len(c.Regions))) | ||
if len(c.Regions) > 0 { | ||
zapctx.Error(ctx, "region controllers check", zap.Int("controllers", len(c.Regions[0].Controllers))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, too.
return errors.E(op, "cloud administration not available for %s", ct.Id()) | ||
// Ensure we always have at least 1 region for the cloud with at least 1 controller | ||
// managing that region. | ||
if len(c.Regions) < 1 || len(c.Regions[0].Controllers) < 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it != 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was != 1
, but that includes cases with > 1
elements which shouldn't result in an error.
Description
Fix the length check in
doCloudAdmin
to allow granting access to clouds that have more than 1 region and more than 1 controller for said region.Addresses the main issue from CSS-5266
Engineering checklist
Check only items that apply