unioslo/mreg

Update zone for existing hosts when adding og removing zone

oyvindkolbu opened this issue · 0 comments

On create/rename/delete of hosts, update zone for existing hosts. Something like

for h in Host.objects.filter(name__endswith=zone.name):
     z = ForwardZone.get_zone_by_hostname(h.name)
     h.zone = z
     h.save()