Skip to content

Fix empty line to contain two values

Corinna Gogolok requested to merge fix_empty_line_in_license_usage_file into master

What does this MR do and why?

Part of https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/3818

Prior to this change, the empty line between the license information header and the user count table only contained a single value. This prevents to convert the license usage file csv into a hash by using to_h and instead requires a manual mapping (see changes in https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/4238). Now, the empty line contains two empty strings to reflect a valid hash structure.

How to set up and validate locally

Without the fix:

  1. Go to /admin/subscription and download the license usage file via the Export license usage file button in the top right corner.
  2. Open a rails console and load the file via CSV.read and convert it to a hash:
    CSV.read(<path_to_license_file>).to_h
  3. See an error like ArgumentError: wrong array length at 6 (expected 2, was 1).

With the fix:

  1. Do step 1 and 2 from above.
  2. No error should occur.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugie Limpin

Merge request reports