X-Git-Url: https://git.openstreetmap.org/dns.git/blobdiff_plain/27a3dfe0c9ce66a7e2fb889260b9cdfffbc79856..1179761c68f6d0bb69ba54231935691d8908fe30:/bin/mkgeo diff --git a/bin/mkgeo b/bin/mkgeo index dcc192a..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}; } @@ -397,11 +394,11 @@ sub output_server { if ($server->{status} eq "up") { - $zonefile->print("+${name}:$server->{ipv4}:600\n"); + $zonefile->print("+${name}:$server->{ipv4}:3600\n"); if ($server->{ipv6}) { -# $zonefile->print("3${name}:$server->{ipv6}:600\n"); +# $zonefile->print("3${name}:$server->{ipv6}:3600\n"); } } }