lantins / dns-zone

A Ruby library for building and parsing DNS zone files.
MIT License
22 stars 13 forks source link

add ability to parse zone file with multiple ORIGIN directives #8

Closed dwradcliffe closed 8 years ago

dwradcliffe commented 8 years ago

I need to be able to parse a zone file with multiple ORIGIN directives. I can try to add this, but I'd like to see what the best API change would be. I've created a failing test to look at one option.

One option would be to return an array of zones when the zone file has multiple origins. This is slightly unexpected behavior, so another option would be to move it to another method, like DNS::Zone.load_multiple or something.

@lantins Any thoughts before I start my implementation?

lantins commented 8 years ago

Returning an array doesn't seem right, neither does fragmenting the API by adding a new method.

How about 'unrolling' the extra ORIGIN directives? by that I mean if you did a load then dump, the dump would exclude the ORIGIN directives, although the records would have been adjusted.

dwradcliffe commented 8 years ago

I think unrolling makes sense. I'll give that a shot.

lantins commented 8 years ago

Cool. Looking forward to your contribution :)

dwradcliffe commented 8 years ago

Ok, pushed new code that seems to be working for me. I had to add a test to make sure the labels were correct with normal zone files because that case wasn't being tested.

Also I think there's a problem with the gem dependencies on ruby 1.9 which causes CI to fail.

lantins commented 8 years ago

Thanks @dwradcliffe