Skip to content
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

Make --cdn-arl-template argument work as expected by Pub [RHELDST-20512] #242

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

rohanpm
Copy link
Member

@rohanpm rohanpm commented Sep 28, 2023

The --cdn-arl-template argument can be used to pass multiple ARL templates, which in practice is needed.

The argument was declared as nargs='*', which means the way it's expected to be used is:

--cdn-arl-template arg1 arg2 arg3 ...

However, the usual convention[1] for list-style arguments in our tools, and the one expected by Pub, is instead:

--cdn-arl-template arg1 \
--cdn-arl-template arg2 \
--cdn-arl-template arg3 ...

So that's how arguments were being passed.

Problem: the latter argument style was accepted, but only the last argument had any effect. This meant, for any target configured with multiple ARL templates, only the last one in the list was being used.

Fix the argument handling to support the usual convention (while remaining backwards-compatible).

This issue has always been present but could be missed until now because:

  • pubtools-pulp never logged the URLs/ARLs flushed, so the mistake can't be noticed from the logs; fixed by [2]

  • there was no test covering the case of multiple ARL templates; fixed here

  • technically the need to flush by multiple ARLs has not been particularly important until recenty, when more CDN origins have been integrated into each environment.

[1] https://release-engineering.github.io/pubtools/devguide.html#arguments-with-multiple-values
[2] #240

The --cdn-arl-template argument can be used to pass multiple ARL
templates, which in practice is needed.

The argument was declared as nargs='*', which means the way it's
expected to be used is:

    --cdn-arl-template arg1 arg2 arg3 ...

However, the usual convention[1] for list-style arguments in our tools,
and the one expected by Pub, is instead:

    --cdn-arl-template arg1 \
    --cdn-arl-template arg2 \
    --cdn-arl-template arg3 ...

So that's how arguments were being passed.

Problem: the latter argument style was accepted, but *only the last
argument had any effect*. This meant, for any target configured with
multiple ARL templates, only the last one in the list was being used.

Fix the argument handling to support the usual convention (while
remaining backwards-compatible).

This issue has always been present but could be missed until now because:

- pubtools-pulp never logged the URLs/ARLs flushed, so the
  mistake can't be noticed from the logs; fixed by [2]

- there was no test covering the case of multiple ARL templates; fixed
  here

- technically the need to flush by multiple ARLs has not been
  particularly important until recenty, when more CDN origins have been
  integrated into each environment.

[1] https://release-engineering.github.io/pubtools/devguide.html#arguments-with-multiple-values
[2] release-engineering#240
@rohanpm rohanpm marked this pull request as ready for review September 28, 2023 00:25
@rohanpm rohanpm requested a review from a team September 28, 2023 00:25
@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (0dffac5) 100.00% compared to head (e509d04) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #242   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           56        56           
  Lines         2973      2974    +1     
=========================================
+ Hits          2973      2974    +1     
Files Coverage Δ
pubtools/_pulp/services/cdn.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rohanpm rohanpm merged commit f85734c into release-engineering:master Sep 28, 2023
8 checks passed
@rohanpm rohanpm deleted the multiple-arls branch September 28, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants