1
我想用Infoblox API更改Infoblox設備中nsgroup的輔助DNS服務器。原始的nsgroup包含兩個輔助DNS服務器,我想放置一個DNS輔助服務器(當然有一個主服務器)。修改Infoblox :: Grid :: DNS的輔助DNS服務器:: Nsgroup
以下代碼更改nsgroup的註釋,但不會更改NS組的輔助服務器!我總是有兩個輔助DNS服務器。該代碼不會觸發任何錯誤。
sub nsGroupSlave {
# https://ipam.illinois.edu/api/doc/Infoblox/Grid/DNS/Nsgroup.html
my @retrieved_obj = $session->get(
object => "Infoblox::Grid::DNS::Nsgroup",
name => "Interne");
my $nsg1 = $retrieved_obj[0];
unless ($nsg1){
msg(t() . "ERROR : " . Infoblox::status_code() . ":" . Infoblox::status_detail(),$v);
} else {
msg(t() . "OK",$v);
}
my @retrieved_objsp = $session->get(
object => "Infoblox::Grid::Member",
name => "ns1.intra.example.com"
);
my $nsp = $retrieved_objsp[0];
my @retrieved_objssi = $session->get(
object => "Infoblox::Grid::Member",
name => "nsZ.intra.example.com"
);
my $nssi = $retrieved_objssi[0];
my @result_array = $session->get(
"object" => "Infoblox::Grid::DNS" ,
"grid" => "infoblox"
);
my $object = $result_array[0];
$nsg1->primary($nsp);
$nsg1->secondaries([$nssi]);
$nsg1->comment("Modify by restore-backup");
my $response1 = $session->modify($nsg1);
unless ($response1) {
msg(t() . "FAIL : ", $session->status_code() . ":" . $session->status_detail(),$v);
}
$object->nsgroups([ $nsg1 ]);
my $response3 = $session->modify($object);
unless ($response3) {
msg(t() . "FAIL : ", $session->status_code() . ":" . $session->status_detail(),$v);
}
$session->restart();
}