06-25-2012 08:31 AM
I have a perl script that uses the Infoblox API to query an appliance for all the zones it is hosting. I didn't write the script but I am trying to modify it. The perl script queries the Infoblox:NS::Zone object and uses the zone() method to get the names of all the DNS zones on the appliance. These names are then plugged into a named.conf file which is distributed to a group of anycast servers.Here is the problem: The reverse zone names for IPv4 and IPv6 zones are not formatted properly and have to be munged to provide a value suitable to be plugged into a named.conf file. I did some poking around and grabbed this array of hashes: @zones = $session->get( object => 'Infoblox:NS::Zone' );Since @zones is really just an array of hash references, I looped through all the zones and printed out every key/value pair that was returned. Now, I didn't use the object methods, I just dereferenced the hashes to look at key/value pairs.I discovered each zone hash has a key named "display_domain" which contains a zone name that is ALREADY in the proper format to be plugged directly into my named.conf file. This appears to be true for both IPv4 and IPv6 reverse zones. I would like to know if it would be reasonable to discontinue using the name() method and just get the dereferenced key/value pair for "display_domain?" There is no object method that will return the "display_domain" which is apparently what I want. The only downside I can see would be if Infoblox later removed the key/value pair for "display_domain" from the Infoblox:NS::Zone object without warning. Then my script would be broken.Are there any gotchas with just dereferencing the $zone hash reference and grabbing the "display_domain" value?
06-25-2012 01:27 PM
what version are you working with? With version six and later, there is a display_domain() capability.
$zone->display_domain() should be available.
06-25-2012 02:24 PM