28mm / blast-radius

Interactive visualizations of Terraform dependency graphs using d3.js
https://28mm.github.io/blast-radius-docs/
MIT License
2.03k stars 256 forks source link

AttributeError: 'NoneType' object has no attribute 'groupdict' #86

Closed PePoDev closed 3 years ago

PePoDev commented 3 years ago

Terraform 0.13.2 OS Ubuntu 20.04 Install via pip

[2020-09-14 18:24:52,501] ERROR in app: Exception on /graph.svg [GET]
Traceback (most recent call last):
  File "/home/pepodev/.local/lib/python3.8/site-packages/blastradius/handlers/dot.py", line 455, in _module
    return m.groupdict()['module']
AttributeError: 'NoneType' object has no attribute 'groupdict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pepodev/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pepodev/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pepodev/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/pepodev/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/pepodev/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pepodev/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/pepodev/.local/lib/python3.8/site-packages/blastradius/server/server.py", line 36, in graph_svg
    dot = DotGraph('', file_contents=run_tf_graph())
  File "/home/pepodev/.local/lib/python3.8/site-packages/blastradius/handlers/dot.py", line 56, in __init__
    self.nodes.append(DotNode(e.target))
  File "/home/pepodev/.local/lib/python3.8/site-packages/blastradius/handlers/dot.py", line 415, in __init__
    self.module         = DotNode._module(self.label) # for module groupings. 'root' or 'module.foo.module.bar'
  File "/home/pepodev/.local/lib/python3.8/site-packages/blastradius/handlers/dot.py", line 457, in _module
    raise Exception("None: ", label)
Exception: ('None: ', '[root] module.allow_nfs (close)')
pinpox commented 3 years ago

Same issue here, did you get it to work?

bonzofenix commented 3 years ago

+1

vibhuyadav commented 3 years ago

+1

pierreyvesv commented 3 years ago

same with Terraform 0.13.4 OS windows WSL ubuntu 18.04 Install via pip3 Python 3.6.9 BlastRadius version (0.1.23)

lllama commented 3 years ago

I was able to "fix" this by changing the regex to be r"(\[root\]\s+)*(?P<module>[^.]+)\.(?P<type>\S+)(\.\S+)?". I still haven't got it to generate a graph but I think that's my impatience at the moment.

szEvEz commented 3 years ago

Anyone got this one working?

erSitzt commented 3 years ago

Same here... Installed with pip3 Terraform v0.14.5 Python 3.6.7 WSL with Ubuntu 18.04 BlastRadius 0.1.23

justinTM commented 3 years ago

@28mm

edvinas-maciulis commented 3 years ago

+1

leriksen commented 3 years ago

I got it to render a graph by changing the regex as well, in blastradius/handlers/dot.py to be

m = re.match(r'(\[root\]\s+)*(?P<module>\S+)\.(?P<type>\S+)[. ]\S+', label)

Not the [. ] after the capture for the <type> group. The offending label that was crashing for me was

[root] module.kv (close)

This character class handles a . or a \s after a module type

I'll submit a PR maybe by the weekend

edvinas-maciulis commented 3 years ago

Thanks @leriksen, also I ended up finding this one - https://github.com/kmussel/blast-radius/. It has some updates and fixes that made it work. There are more commits that may be beneficial to bring back in.

PePoDev commented 3 years ago

Closed. I found alternative to visual infrastructure from Terraform.

https://github.com/cycloidio/inframap https://github.com/pcasteran/terraform-graph-beautifier