-
Notifications
You must be signed in to change notification settings - Fork 95
🌱 Refactoring PR for: Remove usage of FailureReason and FailureMessage (baremetal) #1735
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
base: main
Are you sure you want to change the base?
🌱 Refactoring PR for: Remove usage of FailureReason and FailureMessage (baremetal) #1735
Conversation
janiskemper
left a comment
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.
I didn't fully understand the remediation part. Please add some explanation for the refactoring in the PR description
| host.Spec.Status.ProvisioningState, host.Spec.MaintenanceMode != nil && *host.Spec.MaintenanceMode, | ||
| ) | ||
| return res, nil | ||
| if host == nil { |
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.
can this happen? We handle the not found error... at least it wouldn't make sense
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.
@janiskemper, yes, it can be nil:
func GetAssociatedHost(ctx context.Context, crClient client.Client, hbmm *infrav1.HetznerBareMetalMachine) (*infrav1.HetznerBareMetalHost, error) {
annotations := hbmm.GetAnnotations()
// if no annotations exist on machine, no host can be associated
if annotations == nil {
return nil, nil
}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.
okay, but that's weird for that GetAssociatedHost function no? Then we should probably directly handle the not found error and convert it to nil.
Or is there any reason that the function returns in two ways the same thing?
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.
@janiskemper I just refactored the method, so that it could be re-used. It was like this before. For now, I would like to keep it like this. But I could change it, if you think so.
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.
I would like to change it. Before, it was not a library function, so it was clear from the inline code. Right now, with having this in a separate package, that looks strange.
…e-reason--baremetal--on-top-main
can you please point me to a line in the code? |
|
@guettli I didn't understand the reason for this part "refactored setOwnerRemediatedConditionNew() to setOwnerRemediatedConditionToFailed()" |
Some changes of this PR got extracted, so that the PR gets smaller and easier to review:
🌱 Remove usage of FailureReason and FailureMessage (baremetal) by guettli · Pull Request #1716 · syself/cluster-api-provider-hetzner
tee tmp/test-unit-unfiltered.login test-unis.sh: Write unmodfied output to tmp directory. This is handy if you want to see all logs, without running tests again.return res, nil --> return reconcile.Result{}, nil