From cd71c84ea3565cd553b26cc1b8bd2cf86168b396 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 8 Apr 2020 18:53:22 +0100 Subject: [PATCH] Keep individual server records when servers are down --- bin/mkgeo | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/mkgeo b/bin/mkgeo index ce0ff2f..8cb4687 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -259,11 +259,11 @@ if (!defined($gdnsname)) if (my $default = $cluster->{default}) { - output_server($zonefile, "${default}.${zone}", $cluster); + output_server($zonefile, "${default}.${zone}", $cluster, 0); } elsif (exists($cluster->{default})) { - output_server($zonefile, "${zone}", $cluster); + output_server($zonefile, "${zone}", $cluster, 0); } } } @@ -275,11 +275,11 @@ foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters) if (@{$cluster->{servers}} > 1) { - output_server($zonefile, "${name}-%02d.${zone}", $cluster); + output_server($zonefile, "${name}-%02d.${zone}", $cluster, 1); } else { - output_server($zonefile, "${name}.${zone}", $cluster); + output_server($zonefile, "${name}.${zone}", $cluster, 1); } } @@ -527,10 +527,11 @@ sub output_server my $zonefile = shift; my $name = shift; my $cluster = shift; + my $all = shift; while (my($index,$server) = each @{$cluster->{servers}}) { - if ($server->{status} eq "up") + if ($all || $server->{status} eq "up") { $zonefile->printf(" A(\"${name}\", \"$server->{ipv4}\", TTL(\"10m\")),\n", $index + 1); -- 2.39.5