Skip to content

Check validation only if new record of license

What does this MR do and why?

When uploading a new license to a self-managed instance the user gets a 500 error.

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

  1. Delete the Analytics::UsageTrends::Measurement values
  2. Generate a license with restricted reconciliation_completed flag as true
  3. Load the license on the SM instance
  4. 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.

Related to #346580

Merge request reports

Loading