googledomains: Remove unnecessary host groupings

Each host is already updated individually so there's no point in
grouping the hosts.
This commit is contained in:
Richard Hansen 2024-07-12 18:47:57 -04:00
parent 40e4aee74f
commit 8e20185323

View file

@ -5831,39 +5831,31 @@ EoEXAMPLE
###################################################################### ######################################################################
sub nic_googledomains_update { sub nic_googledomains_update {
debug("\nnic_googledomains_update -------------------"); debug("\nnic_googledomains_update -------------------");
my %groups = group_hosts_by(\@_, [qw(server login password wantip)]); for my $host (@_) {
for my $sig (keys %groups) { my $ip = delete $config{$host}{'wantip'};
my @hosts = @{$groups{$sig}}; info("setting IP address to %s for %s", $ip, $host);
my $key = $hosts[0]; verbose("UPDATE:", "updating %s", $host);
my $ip = $config{$key}{'wantip'};
for my $host (@hosts) { my $url = "https://$config{$host}{'server'}/nic/update";
delete $config{$host}{'wantip'}; $url .= "?hostname=$host";
$url .= "&myip=";
$url .= $ip if $ip;
info("setting IP address to %s for %s", $ip, $host); my $reply = geturl(
verbose("UPDATE:", "updating %s", $host); proxy => opt('proxy'),
url => $url,
my $url = "https://$config{$host}{'server'}/nic/update"; login => $config{$host}{'login'},
$url .= "?hostname=$host"; password => $config{$host}{'password'},
$url .= "&myip="; );
$url .= $ip if $ip; unless ($reply) {
failed("updating %s: Could not connect to %s.", $host, $config{$host}{'server'});
my $reply = geturl( next;
proxy => opt('proxy'),
url => $url,
login => $config{$host}{'login'},
password => $config{$host}{'password'},
);
unless ($reply) {
failed("updating %s: Could not connect to %s.", $host, $config{$host}{'server'});
next;
}
next if !header_ok($host, $reply);
$config{$host}{'ip'} = $ip;
$config{$host}{'mtime'} = $now;
$config{$host}{'status'} = 'good';
} }
next if !header_ok($host, $reply);
$config{$host}{'ip'} = $ip;
$config{$host}{'mtime'} = $now;
$config{$host}{'status'} = 'good';
} }
} }