Comment 8 for bug 1774529

Revision history for this message
Vladimir Grevtsev (vlgrevtsev) wrote : Re: [2.4] Cannot delete some instances of model 'Domain' because they are referenced through a protected foreign key

Reproduced on latest 2.8.2 (8577-g.a3e674063-0ubuntu1~18.04.1) but only via UI - domains/records created with CLI are deleted ok:

<CLI>

ubuntu@OrangeBox84:~$ maas admin domains create name=mydomain
Success.
Machine-readable output follows:
{
    "authoritative": true,
    "ttl": null,
    "name": "mydomain",
    "is_default": false,
    "resource_record_count": 0,
    "id": 4,
    "resource_uri": "/MAAS/api/2.0/domains/4/"
}
ubuntu@OrangeBox84:~$ maas admin dnsresource-records create fqdn=devci.mydomain rrtype=NS rrdata=ns1-devci.maas
Success.
Machine-readable output follows:
{
    "ttl": null,
    "rrtype": "NS",
    "rrdata": "ns1-devci.maas",
    "id": 5,
    "fqdn": "devci.mydomain",
    "resource_uri": "/MAAS/api/2.0/dnsresourcerecords/5/"
}

ubuntu@OrangeBox84:~$ maas admin dnsresource-record delete 5
Success.
Machine-readable output follows:

ubuntu@OrangeBox84:~$ maas admin domain delete 4
Success.
Machine-readable output follows:

ubuntu@OrangeBox84:~$