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

Fix undeclared vars for custom report creation. #210

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

heubeck
Copy link
Collaborator

@heubeck heubeck commented Jan 8, 2024

Executing depscan --report-template depscan.j2 --bom empty.json with
empty.json being only {}, depscan fails with

Traceback (most recent call last):
  File "/home/heubeck/.local/bin/depscan", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/heubeck/.local/lib/python3.12/site-packages/depscan/cli.py", line 1041, in main                                                                                          pkg_vulnerabilities=pkg_vulnerabilities,
                        ^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'pkg_vulnerabilities' where it is not associated with a value

Added the with 5.1.6 newly introduced vars to the initialization similar
to the other variables provided to the jinja engine.

Executing `depscan --report-template depscan.j2 --bom empty.json` with
`empty.json` being only `{}`, depscan fails with

```
Traceback (most recent call last):
  File "/home/heubeck/.local/bin/depscan", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/heubeck/.local/lib/python3.12/site-packages/depscan/cli.py", line 1041, in main                                                                                          pkg_vulnerabilities=pkg_vulnerabilities,
                        ^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'pkg_vulnerabilities' where it is not associated with a value
```

Added the with 5.1.6 newly introduced vars to the initialization similar
to the other variables provided to the jinja engine.

Signed-off-by: Florian Heubeck <heubeck@mediamarktsaturn.com>
Copy link
Member

@prabhu prabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@heubeck heubeck merged commit b8be7eb into master Jan 8, 2024
54 checks passed
@heubeck heubeck deleted the fix-undeclared-new-vars branch January 8, 2024 08:54
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

Successfully merging this pull request may close these issues.

2 participants