Plugin JobRunner failing to see new object #19103
Unanswered
callieglade
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm writing a reservation plugin so that when an object is created, the
save()
function creates a background job which changes the object's status from Active to Inactive at the reservation's end date. I've written my jobs based on this doc, and it creates the job, but immediately errors out withAttributeError("'NoneType' object has no attribute 'status'")
. It seems the reservation object isn't being passed correctly to the job, but i'm not sure how to fix this or what's wrong in my code. I'm on v4.2.6.Here's a snippet of relevant information from my
models.py
:and here's a snippet from my
jobs.py
:Here are the logs I see from netbox-worker for the creation (and subsequent erroring out) of this job:
the status choices from the model, and the scheduled_at time, are accurately passed to handle(), and the correct object_type is also there. If I were to guess based on all of this, it seems like the issue has to do with the object not existing yet at the time that
enqueue()
is called. However, if this is the case, I don't know how to work around this such that the job is created on object creation. Possibly apost_save
signal, but I don't want to dive into that rabbit hole until I'm more confident that I should go that direction.Beta Was this translation helpful? Give feedback.
All reactions