Add templating functionality

Issue #1 resolved
created an issue

In comparing django-powerdns-manager to some of the other tools out there, I noticed that it doesn't have any sort of "create zone from template" functionality. Such a thing would be good to have--that way people aren't typing in serial numbers, nameservers, mx info, @ A records, etc. from scratch each time.

Comments (9)

  1. johnmill reporter

    Zone cloning capability's something that would probably suit our needs just fine. Just create a zone or two--call them subdomain.template and newzone.template. They won't necessarily be part of the public DNS--we put them on a hidden master, for example, but they will be visible to actually work with.

  2. George Notaras repo owner

    Added experimental zone cloning functionality.

    It works like this:

    1. Select one zone from the list.
    2. Select the "Clone the selected zone" action.
    3. Provide a new domain name for the clone.

    The clone's RRs contain the new domain name (where such domain interchange is possible to be done automatically without making wild guesses)

    I hope this works as expected. It is still very experimental. Your feedback is much appreciated.

    Full templating functionality is still an ongoing effort and its implementation will be delayed for a while. I'll keep this ticket open until this is actually implemented.

  3. George Notaras repo owner

    I also think creating a few zones, which are meant to be used as templates, in a hidden master seems like a good way to go at the moment.

    However, cloning live zones seems to also work fine for me.

    If PowerDNS supported checking a specific field in order to consider zones as public/private (or in other words an on/off switch), that field could have been used to easily hide those template-zones from the public.

    Another option would be to find a way (perhaps using proxy models and a database router) to store zones/records/metadata of template-zones to a different database. But this is probably not something a user or administrator would expect from a frontend.

    Otherwise, full templating functionality will require to -at least- implement extra models for template-zones and template-records and also create new modelforms that do not perform validation as strict as the current forms. This possibly involves a lot of work and I don't think I'll have enough free time to spend on it soon. But I'll definitely experiment with that feature.

    If you can find a better/easier way to do it, please let me know.

  4. johnmill reporter

    Agreed--full-on template functionality would indeed require extra models for template zones and records, and/or changing existing models to include a "template" flag. It's a big change to the underlying design of the application.

    I'll definitely keep working on this--a good solution may present itself.

  5. George Notaras repo owner

    They say "better late than never"...

    At the time this issue was submitted, the full potential of actions was not clear to me. Digging in to the Django source code, I found out more details (some undocumented) about actions with intermediate pages. This opened the way to easily add basic zone templates.

    The template is actually a zone file, which may contain the placeholder #origin#. Before creating a new zone from the template the user is asked for the origin of the new zone. #origin# is replaced with this user-defined origin and the new zone is created.

    After some thought I realized that full blown zone template functionality using separate models for zones and resource records would never happen.

    I mark this issue as closed. Feel free to open a new one for any suggestions or corrections about this functionality.

    Thanks for your feedback.

  6. Log in to comment