-
Notifications
You must be signed in to change notification settings - Fork 263
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
Signal error to the GUI if a syntactically incorrect job is loaded from a git repository #138
Comments
Hello @Kircheneer, thanks for the submission. What is the current behavior you're experiencing? It sounds like if a job is attempting to be loaded, it is failing silently or in a non-obvious way? Can you please add some context on your experience? Thanks in advance! |
I just did the following things:
Is there maybe some caching at play here which I am missing? |
@glennmatthews Can you please help me confirm this one? :) |
I am unable to reproduce this on Nautobot v1.0.0b2. The job appears to still load but the Can you please build and install Thanks! |
Tagging @Kircheneer to see @jathanism's last comment! |
That leads to a new error (when copying the default job from the docs again): Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/nautobot/extras/jobs.py", line 826, in _run_job
output = job.run(data=data, commit=commit)
File "/root/.nautobot/git/test/jobs/example.py", line 37, in run
site = Site(
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py", line 483, in __init__
_setattr(self, field.name, rel_obj)
File "/usr/local/lib/python3.8/dist-packages/django/db/models/fields/related_descriptors.py", line 215, in __set__
raise ValueError(
ValueError: Cannot assign "'planned'": "Site.status" must be a "Status" instance. Leaving that aside because it is not relevant to this issue (EDIT: #186), I have created this public repository. Try the "master" and the "test" branch in there. For me, the job from the "master" branch exhibits the behavior mentioned above, while the (faulty, runs with errors) script I copied from the docs in the "test" branch is recognized without issues. This is using
|
@Kircheneer That's progress! It does look like the In any case your issue is on line 41: https://github.com/Kircheneer/nautobot_data/blob/master/jobs/example.py#L41 You want that to be an instance of a # at the top
from nautobot.extras.models import Status
# one line 41
status=Status.objects.get(slug="planned"), Can you please see if updating your job fixes your issue? |
I can verify the reported behavior using the "master" branch of the linked repo - the job fails (from the user's perspective) silently to load when accessing the Jobs UI, although the error is logged to the console at least:
It would be reasonable for us to add some handling logic to report errors as a banner on the Jobs page, along the lines of "The following job files could not be loaded...". Thanks for the report! |
Needs to be retested for 1.3/1.4 as symptoms may have changed with concrete Job model. |
Environment
Using nautobot-lab at 1.0.0b1
Proposed Functionality
If there is a syntactical error in a job file in a git repository there should be a warning or an error message in the sync job logs that indicates this.
Use Case
If someone was to write a job in a git repository and for example miss an import they wouldn't know if the error lies
Database Changes
None
External Dependencies
None
The text was updated successfully, but these errors were encountered: