From: Tom Hughes Date: Wed, 14 Aug 2013 09:51:12 +0000 (+0100) Subject: Output all target origins even if they have nothing assigned X-Git-Url: https://git.openstreetmap.org./dns.git/commitdiff_plain/e8d2cbde2ca6c6fb1a2867342132c5d7b93a5bd9?hp=b9a33b134683c97f6fa06fa13eeefed997000d3f Output all target origins even if they have nothing assigned --- diff --git a/bin/mkgeo b/bin/mkgeo index 8dbe80a..4dceb1d 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -105,11 +105,22 @@ if ($ENV{PINGDOM_USERNAME} && $ENV{PINGDOM_PASSWORD}) } } +# Create target origins object +my $targetorigins = {}; + # Initialise cluster details while (my($name,$cluster) = each %$clusters) { $cluster->{bandwidth_limit} = $cluster->{bandwidth} * 1024 * 1024; $cluster->{bandwidth_used} = 0; + + $targetorigins->{$cluster->{name}} = { + code => $cluster->{name}, + name => $cluster->{name}, + lat => $cluster->{lat}, + lon => $cluster->{lon}, + bandwidth => 0 + }; } my @mappings = (); @@ -162,9 +173,6 @@ while (grep { !exists($_->{cluster}) } values %$origins) # Create JSON collection object my @json; -# Create target origins object -my $targetorigins = {}; - # Open output files my $zonefile = IO::File->new("> data/${zone}") || die "$!"; my $jsonfile = IO::File->new("> json/${zone}.json") || die "$!"; @@ -203,17 +211,6 @@ foreach my $origin (values %$origins) } }; - unless (exists($targetorigins->{$cluster->{name}})) - { - $targetorigins->{$cluster->{name}} = { - code => $cluster->{name}, - name => $cluster->{name}, - lat => $cluster->{lat}, - lon => $cluster->{lon}, - bandwidth => 0 - }; - } - $targetorigins->{$cluster->{name}}->{bandwidth} += $origin->{bandwidth}; }