Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a fallback to generate_mirror_map for broken regions

  • Loading branch information...
commit bed63588fab781e0910fa3c97cac8a814c8188b0 1 parent f514926
Alexander Wirt formorer authored

Showing 1 changed file with 11 additions and 3 deletions. Show diff stats Hide diff stats

  1. +11 3 bin/generate_mirror_map
14 bin/generate_mirror_map
@@ -11,18 +11,26 @@ $state = $m->state ; # the mirmon state
11 11
12 12 use Data::Dumper;
13 13 my $mirrors;
  14 +my $regions_hash;
14 15 foreach my $url ( keys %{$state} ) {
15 16 next unless $url =~ /^http/;
16 17 $mirror = $state -> { $url } ; # a Mirmon::Mirror object
17 18 my ($time, $history) = split('-', $mirror->{state_history});
18 19 my $last_state = substr($history,-1,1);
19   - next if $last_state eq 'f';
20 20 my $region = $mirror->region;
  21 + $regions_hash->{$region} = 1;
  22 + next if $last_state eq 'f';
21 23 $mirrors->{ $region } ||= [];
22 24 $url =~ s/^http:\/\///;
23 25 push @{$mirrors->{ $region }}, $url;
24 26 }
25 27
26   -foreach my $region (keys %{$mirrors}) {
27   - printf ("%s %s\n", lc($region), join('|', @{$mirrors->{$region}}));
  28 +my @regions = keys(%$regions_hash);
  29 +
  30 +foreach my $region (@regions) {
  31 + if (scalar(@{$mirrors->{$region}}) == 0) {
  32 + printf ("%s %s\n", lc($region), join('|', @{$mirrors->{'DE'}}));
  33 + } else {
  34 + printf ("%s %s\n", lc($region), join('|', @{$mirrors->{$region}}));
  35 + }
28 36 }

0 comments on commit bed6358

Please sign in to comment.
Something went wrong with that request. Please try again.