yandex: 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 20:16:21 -04:00
parent 216c9c6010
commit 5d2a1e864a

View file

@ -6398,15 +6398,9 @@ EoEXAMPLE
######################################################################
sub nic_yandex_update {
debug("\nnic_yandex_update -------------------");
my %groups = group_hosts_by(\@_, [qw(server login pasword wantip)]);
for my $sig (keys %groups) {
my @hosts = @{$groups{$sig}};
my $key = $hosts[0];
my $ip = $config{$key}{'wantip'};
my $headers = "PddToken: $config{$key}{'password'}\n";
for my $host (@hosts) {
delete $config{$host}{'wantip'};
for my $host (@_) {
my $ip = delete $config{$host}{'wantip'};
my $headers = "PddToken: $config{$host}{'password'}\n";
info("setting IP address to %s for %s", $ip, $host);
verbose("UPDATE:", "updating %s", $host);
@ -6414,10 +6408,10 @@ sub nic_yandex_update {
# Get record ID for host
my $url = "https://$config{$host}{'server'}/api2/admin/dns/list?";
$url .= "domain=";
$url .= $config{$key}{'login'};
$url .= $config{$host}{'login'};
my $reply = geturl(proxy => opt('proxy'), url => $url, headers => $headers);
unless ($reply) {
failed("updating %s: Could not connect to %s.", $host, $config{$key}{'server'});
failed("updating %s: Could not connect to %s.", $host, $config{$host}{'server'});
next;
}
next if !header_ok($host, $reply);
@ -6440,7 +6434,7 @@ sub nic_yandex_update {
# Update the DNS record
$url = "https://$config{$host}{'server'}/api2/admin/dns/edit";
my $data = "domain=";
$data .= $config{$key}{'login'};
$data .= $config{$host}{'login'};
$data .= "&record_id=";
$data .= $id;
$data .= "&content=";
@ -6472,7 +6466,6 @@ sub nic_yandex_update {
$config{$host}{'mtime'} = $now;
$config{$host}{'status'} = 'good';
}
}
}
######################################################################