Reply

Perl script for changing zone (SOA) serial number

[ Edited ]
StefanvanH
Techie
Posts: 9
2158     0

Hello,

 

I'm working on a perl script which checks the zones serial number and if the size (total numbers) is smaller then 10 it should change the serial number.

Changing the serial number doesn't seem to have an effect, perhaps I'm using the wrong API call ?

Here is a snippet of my script:

 

my @result = $session->get (
      object => "Infoblox:Smiley Very HappyNS::Zone",
      view => "Internet",
      );

 

foreach my $string (@result) {

    my $zone = $string->dns_name;
    if ($zone =~ m/[\/]/){                                                  #Skip the reverse zones
        next;
    }
    my $serial = $string->soa_serial_number;
    my $delegate = $string->delegate_to;
    if (length $delegate){                                                #Skip delegated zone
        next;
    }
    if (length $serial < 10 ) {
        print "Zone $zone had serial: $serial\n";

        my $zn = $string->soa_serial_number("2017013001");     #change to new serial number
        my $response = $session->modify( $zn );       #apply change
    }
}

 

I hope someone can help me out.

 

Regards,

 

Stefan

Re: Perl script for changing zone (SOA) serial number

StefanvanH
Techie
Posts: 9
2159     0

For now I have a workaround and let the script create a CSV file so I can use it for CSV import and modify the serial numbers.

But it should be possible to change the soa serial number of a zone using the perl API shouldn't it ?

Showing results for 
Search instead for 
Do you mean 

Recommended for You