What does this MR do and why?
When uploading a new license to a self-managed instance the user gets a
The error is around the
reconciliation_completed flag and unfortunately around the codebase.
When the license is added for the first time the error will not occur.
When the instance is restarted, the validation for the license is called when the
valid? method for the license is called.
valid? method checks if the license is still valid and started.
valid? checks all the validations of the license including the
check_restricted_user_count method which in turn would call the User's
billable method and which in turn will call the
License.load. Loading the license will check its validity again and that would lead to the loop being formed.
The MR would only call the validation when the License is uploaded the first time and when the validation error should be thrown if the new license loaded does not fulfil few criteria.
How to set up and validate locally
- Delete the Analytics::UsageTrends::Measurement values
- Generate a license with restricted
reconciliation_completedflag as true
- Load the license on the SM instance
- Restart the SM instance and it will loop indefinitely.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
I have evaluated the MR acceptance checklist for this MR.
Related to #346580