-
Notifications
You must be signed in to change notification settings - Fork 21
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
Bug: Creating two policy templates with the same name succeeds #69
Bug: Creating two policy templates with the same name succeeds #69
Conversation
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.
Looks good overall, the test looks good. I'm just worried about the weird error case.
if err != nil { | ||
reqLogger.Error(err, "Failed to check duplicate configurationpolicy name") | ||
|
||
return reconcile.Result{}, 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.
I think the error flow here could cause some problems. It looks like an error can occur if a template object definition isn't valid and can't be unmarshalled. This return makes it give up forever, without putting a status on the policy...
I think the unmarshal error could be ignored in hasDupName
, and just skip those templates. So hasDupName
wouldn't return an error, and the logic would be a bit simpler. The same error should appear later when the templates are being considered individually, right?
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.
good great catch!
Signed-off-by: Yi Rae Kim <yikim@redhat.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JustinKuli, yiraeChristineKim The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Creating a policy with identical names succeeds. The ConfigurationPolicy is repeatedly overwritten by the template-sync, swapping out the two policies, and repeatedly updating the status with alternating statuses from the two policies.
For example, this policy has two ConfigurationPolicy templates both named policy-pod
Expect to fail and return a status that there is a duplicate name instead.
Ref: https://issues.redhat.com/browse/ACM-5724
Signed-off-by: Yi Rae Kim yikim@redhat.com