unioslo/mreg

Make it possible to delete a Zone that contains hosts

oyvindhagberg opened this issue · 4 comments

If using -force and being a super-user, it should be possible to delete a zone even if it contains hosts.
In that case, the host objects should also be deleted.

This is what happens now:

mreg> zone delete cristin.no                                                             
WARNING: : Zone has 8 registered entries, must force
mreg> zone delete cristin.no -force                                                      
WARNING: : DELETE "https://mreg.uio.no/api/v1/zones/forward/cristin.no": 403: Forbidden
{
     "ERROR": "cristin.no still in use by 8 hosts"
}

Why? Isn't this a wanted safety mechanism? @oyvindkolbu

And is this really an mreg issue or mreg-cli issue? 🤔

Why? Isn't this a wanted safety mechanism? @oyvindkolbu

On the mreg side it is a safety mechanism. Wrongly deleting a zone would be bad.

And is this really an mreg issue or mreg-cli issue?

Depends. If the API should in fact support deleting a zone with entires (more than just hosts!), mreg-cli should have a bit more seatbelts than just a plain -force.

My two cents regarding this issue:

It shouldn't be easy to delete a zone that contains entries. The cumbersomeness of having to delete the content is outweighed by the danger of possibly deleting a zone unintentionally.

Innspill fra hostmaster:

Jeg mener at de (svært få) av oss som er superbrukere burde få lov til å
slette en sone med innhold dersom vi bruker "-force", men det er ikke
noe som er veldig viktig for meg (det er ikke mye jobb å scripte
sletting av alle entries i en sone).

Derimot : dersom det ikke skal være mulig (som nå), så bør
feilmeldingen endres til å si noe annet enn :

 WARNING: : Zone has 8 registered entries, must force

siden denne "must force" jo ikke hjelper.

Anders