Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete_identity failed #860

Open
lixincnnic opened this issue Jun 9, 2017 · 1 comment
Open

delete_identity failed #860

lixincnnic opened this issue Jun 9, 2017 · 1 comment

Comments

@lixincnnic
Copy link

lixincnnic commented Jun 9, 2017

I use RPKI-1.0 and
My test flow is as following:

  1. Create identity named 351

  2. Allocate resource ip and as for 351
    $ rpkic -i 351 show_received_resources
    Parent: CNNIC
    notBefore: 2017-05-18T03:14:00Z
    notAfter: 2018-05-18T03:05:56Z
    URI: rsync://218.241.106.164/rpki/CNNIC/cLWkGVfNzQbY56-HCj-E9UiQ0KA.cer
    SIA URI: rsync://218.241.106.164/rpki/CNNIC/351/
    AIA URI: rsync://218.241.106.164/rpki/CNNIC/jq7t5gSEh6Z8Qt9D-8OWuTk2udc.cer
    ASN: 45113
    IPv4: 110.51.0.0/16
    IPv6:

  3. Delete resource ip and as from 351
    $ rpkic -i 351 show_received_resources (nothing)

  4. Delete identity 351 and error occurs
    $ rpkic -i 351 delete_identity
    Traceback (most recent call last):
    File "/usr/sbin/rpkic", line 57, in
    rpki.rpkic.main()
    File "/usr/lib/python2.7/dist-packages/rpki/rpkic.py", line 129, in init
    self.main(args)
    File "/usr/lib/python2.7/dist-packages/rpki/rpkic.py", line 136, in main
    args.func(self, args)
    File "/usr/lib/python2.7/dist-packages/rpki/rpkic.py", line 570, in do_delete_identity
    self.zoo.delete_tenant()
    File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 225, in exit
    connection.commit()
    File "/usr/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 173, in commit
    self._commit()
    File "/usr/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 142, in _commit
    return self.connection.commit()
    File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 98, in exit
    six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/usr/lib/python2.7/dist-packages/django/db/backends/base/base.py", line 142, in _commit
    return self.connection.commit()
    django.db.utils.IntegrityError: update or delete on table "irdb_parent" violates foreign key constraint "app_resourcecert_parent_id_66245720ebcb03a_fk_irdb_parent_id" on table "app_resourcecert"
    DETAIL: Key (id)=(164) is still referenced from table "app_resourcecert".

So, please help me.

Thanks&Regards

@sraustein
Copy link
Contributor

Thanks for the report. So, this is a little odd, for two reasons:

  1. The referencing table name (app_resourcecert) is an obscure hint that referencing table is part of the GUI. That is, the SQL table that's causing this error is part of the GUI. You don't show any GUI operations in your description, so I'm not sure how the GUI ever got involved here.

  2. The error is also puzzling because Django's default behavior is (or at least used to be) to emulate ON CASCADE DELETE. Getting an integrity error here sounds more like ON DELETE PROTECT. See https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey.on_delete for details.

So the first thing to try is just to see whether deleting this in the GUI works better than deleting it using rpkic. Not being able to delete it via rpkic is definitely a bug, just trying to figure out where the bug is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants