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

Unable to generate graph using -g #2982

Open
vennemp opened this issue Dec 20, 2023 · 2 comments
Open

Unable to generate graph using -g #2982

vennemp opened this issue Dec 20, 2023 · 2 comments

Comments

@vennemp
Copy link

vennemp commented Dec 20, 2023

CloudFormation Lint Version

0.83.6

What operating system are you using?

MacOS - Apple Silicon

Describe the bug

I get the following error when I try to render a graph from my template.

`% cfn-lint vpc.yml -g

Traceback (most recent call last):
File "/opt/homebrew/bin/cfn-lint", line 8, in
sys.exit(main())
^^^^^^
File "/opt/homebrew/Cellar/cfn-lint/0.83.6/libexec/lib/python3.12/site-packages/cfnlint/main.py", line 39, in main
matches = list(cfnlint.core.get_matches(filenames, args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/cfn-lint/0.83.6/libexec/lib/python3.12/site-packages/cfnlint/core.py", line 173, in get_matches
matches = run_cli(
^^^^^^^^
File "/opt/homebrew/Cellar/cfn-lint/0.83.6/libexec/lib/python3.12/site-packages/cfnlint/core.py", line 69, in run_cli
template_obj.build_graph()
File "/opt/homebrew/Cellar/cfn-lint/0.83.6/libexec/lib/python3.12/site-packages/cfnlint/template/template.py", line 87, in build_graph
self.graph.to_dot(path)
File "/opt/homebrew/Cellar/cfn-lint/0.83.6/libexec/lib/python3.12/site-packages/cfnlint/graph.py", line 276, in to_dot
view = self.settings.subgraph_view(self.graph)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/cfn-lint/0.83.6/libexec/lib/python3.12/site-packages/cfnlint/graph.py", line 48, in subgraph_view
n for n, v in graph.nodes.items() if v["type"] in ["Resource"]
~^^^^^^^^
KeyError: 'type'
`

Expected behavior

I want to generate a graph

Reproduction template

It is like this with all templates.

@vennemp vennemp changed the title Unable to use Unable to generate graph using -g Dec 20, 2023
@kddejong
Copy link
Contributor

Not able to reproduce using a pip install on Mac. Issue may be related to homebrew so I'll have to do some more testing.

All nodes should have a type
https://github.com/aws-cloudformation/cfn-lint/blob/ac630a0307dd05bc1e217da81818ff544365da58/src/cfnlint/graph.py#L240C9-L250

We could use v.get("type") to be careful

n for n, v in graph.nodes.items() if v["type"] in ["Resource"]

@vennemp
Copy link
Author

vennemp commented Dec 20, 2023

It definitely seems related to homebrew vs pip. After trying -g tag - it completely bricked my local install of python. Can't even using boto3 anymore...Gonna take a while to debug this - please let me know if you have any tips.

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

No branches or pull requests

2 participants