Skip to content

Commit

Permalink
fix .mirrorlist doesnt always work for repomd.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-suse committed Mar 7, 2024
1 parent d50761d commit f80f0ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/MirrorCache/Datamodule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ sub _init_path($self) {
$self->agent; # parse headers
if (
( $self->accept_all || !$self->extra )
&& $self->_original_path eq $path
&& $path =~ m/\/(repodata\/repomd\.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha\d\d\d(\.asc)?|Release(\.key|\.gpg)?|InRelease|Packages(\.gz|\.zst)?|Sources(\.gz|\.zst)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?|tar\.zst(\.sig)?))?|(files|primary|other)\.xml\.(gz|zck|zst)|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz|zst)|gpg-pubkey.*\.asc|CHECKSUMS(\.asc)?)$/
) {
$self->must_render_from_root(1);
Expand Down
10 changes: 7 additions & 3 deletions t/environ/03-headquarter-subsidiaries-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ hq_address=$(mc9/print_address)
hq_interface=127.0.0.10
eu_interface=127.0.0.3

# repodata/repomd.xml is served from root even when asked from EU
echo repodata/repomd.xml is served from root even when asked from EU
curl -si --interface $eu_interface http://$hq_address/download/folder1/repodata/repomd.xml | grep -A20 '200 OK' | grep repomdcontent
# repodata/repomd.xml is served even when DB is down
echo repodata/repomd.xml shows mirrorlist
curl -si --interface $eu_interface http://$hq_address/download/folder1/repodata/repomd.xml.mirrorlist | grep -F '<!DOCTYPE html>'
curl -si --interface $eu_interface -H 'Accept: */*' http://$hq_address/download/folder1/repodata/repomd.xml.mirrorlist | grep -F '<!DOCTYPE html>'
curl -si --interface $eu_interface -H 'Accept: */*, application/xml' http://$hq_address/download/folder1/repodata/repomd.xml.mirrorlist | grep -F '<!DOCTYPE html>'

echo repodata/repomd.xml is served even when DB is down
$mc9/db/stop
curl -si --interface $eu_interface http://$hq_address/download/folder1/repodata/repomd.xml | grep -A20 '200 OK' | grep repomdcontent


curl -si --interface $eu_interface http://$hq_address/geoip | grep -A 50 '200 OK' | grep "<host>euaddress.net</host>"
curl -si http://$hq_address/geoip | grep -A 50 '200 OK' | grep "<host>naaddress.com</host>"

Expand Down

0 comments on commit f80f0ad

Please sign in to comment.