From 82e78ee22d1c96f64d3b71c33f289579d4198a58 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 26 Aug 2016 19:45:16 +0100 Subject: [PATCH 1/1] Output geodns zones in sorted order --- bin/mkgeo | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/mkgeo b/bin/mkgeo index 4bd4db2..60c1abb 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -69,7 +69,7 @@ if ($ENV{PINGDOM_USERNAME} && $ENV{PINGDOM_PASSWORD}) if (-f "pingdom.yml") { - $cache = YAML::LoadFile("pingdom.yml"); + $cache = YAML::LoadFile("pingdom.yml"); } else { @@ -189,7 +189,7 @@ my $zonefile = IO::File->new("> data/${zone}") || die "$!"; my $jsonfile = IO::File->new("> json/${zone}.json") || die "$!"; # Output details for each country -foreach my $origin (values %$origins) +foreach my $origin (sort { $a->{name} cmp $b->{name} } values %$origins) { my $cluster = $origin->{cluster}; my $clon = $origin->{lon}; @@ -229,8 +229,10 @@ foreach my $origin (values %$origins) $zonefile->print("# Unknown origins\n"); # Output default records for IPs that can't be mapped to a country -while (my($name,$cluster) = each %$clusters) +foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters) { + my $name = $cluster->{name}; + if (my $default = $cluster->{default}) { output_server($zonefile, "${default}.${zone}", $cluster); @@ -245,8 +247,10 @@ while (my($name,$cluster) = each %$clusters) $zonefile->print("# Servers\n"); # Output A records for each cluster -while (my($name,$cluster) = each %$clusters) +foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters) { + my $name = $cluster->{name}; + output_server($zonefile, "${name}.${zone}", $cluster); } -- 2.39.5