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

Ignore old custom field data #533

Closed
jakubkrysl opened this issue Jun 4, 2021 · 5 comments · Fixed by #637
Closed

Ignore old custom field data #533

jakubkrysl opened this issue Jun 4, 2021 · 5 comments · Fixed by #637
Assignees
Labels
type: bug Something isn't working as expected

Comments

@jakubkrysl
Copy link

Environment

  • Python version: 3.6.8
  • Nautobot version: 1.0.1

We used to have a custom field asw_vulnerabilityscan assigned to IP Addresses. It is no longer assigned to this model, but still exists and is assigned to other models. But our DB contains this field for 1036 of such IPs. Editing any of these is not possible as it crashes on the field being set.
image

AFAICT is it great to keep this data as long as the field exists since it is very easy to missclick and remove the field from some model by accident. But form validation should ignore these.

Steps to Reproduce

  1. Create custom field
  2. Assign it to some object
  3. Create instance of such object
  4. Fill in the custom field
  5. Unassign the custom field from the object
  6. Try to edit the created instance

Expected Behavior

No issues found.

Observed Behavior

Unable to edit, old custom field data breaks for validation.

@jakubkrysl
Copy link
Author

I'm sorry, the reproducer might be incomplete. During process of fixing the data I found out assigning and unassigning the custom field starts RQ task nautobot.extras.tasks.provision_field, which takes quite some time. It timed out, which might be why there are some IPs with that custom field still set in the first place. Nonetheless form validation should not takes this data into account as user has no control over sending them.

@jathanism
Copy link
Contributor

Hmmm... This is interesting. So you're saying that the worker was unable to complete the task and it resulted in this bizarre behavior?

@jathanism jathanism added status: under review type: bug Something isn't working as expected labels Jun 4, 2021
@david-kn
Copy link
Contributor

david-kn commented Jun 4, 2021

Hmmm... This is interesting. So you're saying that the worker was unable to complete the task and it resulted in this bizarre behavior?

Exactly (let me join this conversation as a @Thetacz colleague :-) ) - it is impossible to edit such an object (record) and this error is shown by nautobot.

@jathanism
Copy link
Contributor

Okay thanks. Need to try to reproduce this and I'll follow up!

@lampwins
Copy link
Member

lampwins commented Jun 4, 2021

So there are realistically two bugs here.

  1. The custom field background tasks are not being run in an atomic transaction. This is an oversight on my part.
  2. The job times out on larger data sets. This one will be easier to sort out in 1.1 with Replace RQ with Celery as queuing backend #223 which is already underway.

Additionally, we should probably create a command to normalize custom field data in the event one of these jobs fails. Muck like the trace paths command.

jathanism added a commit that referenced this issue Jul 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants