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