Add "dumpallzones" command to dump all zones in BIND9 format #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new
dumpallzones
command to dump all zones in BIND9 format. This is useful to backup an entire ClouDNS account.Technically this could be accomplished in an external script by calling
cloudns_api.sh listzones
followed bycloudns_api.sh dumpzone
for every zone. However,dumpzone
itself useslistzones
to determine if the specified zone is a valid zone in the account. This means that callingdumpzone
20 times also callslistzones
20 times! That's a waste of API calls, particular in this case where we know the zone names are valid.To fix this, I split the
dump_zone
function into two separate functions:dump_zone
that does all the validation, anddump_zone_impl
that actually does the zone export.dump_all_zones
usesdump_zone_impl
directly, as it does not need to perform any of the validation.