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

JobResult view should robustly handle cases where data format is not as expected #453

Closed
glennmatthews opened this issue May 14, 2021 · 4 comments
Labels
type: bug Something isn't working as expected

Comments

@glennmatthews
Copy link
Contributor

Environment

  • Python version: any
  • Nautobot version: 1.0.1

Steps to Reproduce

  1. Via a Job or via nbshell, create or modify a JobResult object so that its data attribute is formatted differently than the "standard" data format constructed and modified by calling JobResult.log, for example jobresult.data = {'hello': 'world', 'this': ['is', 'a', 'list'], 'logger': {'log': [['x', 'y', 'z', 'p', 'd', 'q', 'b', 'b', 'q']]}}.
  2. In the UI under extras/job-results/, click on the timestamp link, as if to view details of this JobResult record

Expected Behavior

JobResult detail view should render successfully:

  • Since this JobResult doesn't conform to the "standard" data for logging format, the usual table of log results should presumably not be shown
  • For bonus points, the raw JSON of the data should be displayed as a fallback option.

Alternatively (though in my opinion less desirably) the JobResult clean() or save() APIs should verify that the data format is as expected and reject any attempt to create data that does not conform to the format.

Observed Behavior

ValueError is thrown, for example:

image

@glennmatthews glennmatthews added the type: bug Something isn't working as expected label May 14, 2021
@glennmatthews
Copy link
Contributor Author

Personally I'd love to address this via a larger JobResult rework that would move log entries into their own separate standalone data model and return JobResult.data to being an arbitrary JSON store.

@glennmatthews
Copy link
Contributor Author

#1030 may address this - need to circle back here and verify.

@smk4664
Copy link
Contributor

smk4664 commented Dec 13, 2021

#1030 may address this - need to circle back here and verify.

Yes it does, I knew I was missing one, but couldn't find it. Adding to the Fixes...

@glennmatthews
Copy link
Contributor Author

Fixed by #1030.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2022
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

No branches or pull requests

3 participants