-
Notifications
You must be signed in to change notification settings - Fork 258
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
HCL Parser Error #28
Comments
@ChairmanTubeAmp thanks for reporting. I think a debug mode will be a good idea. When I've had issues with PyHCL in the past, I've tried to isolate the file and line number, with the snippet below. from glob import iglob
import hcl
for filename in iglob('**.tf'):
with open(filename, 'r') as f:
print(filename)
hcl.loads(f.read()) Maybe the debug mode should fall back to something like this. Curious to know how the unexpected RIGHTBRACE comes up in your case. |
I'm getting a similar error. It occurs whether blast-radius is locally installed, using the official docker image or using a custom docker image with a newer version of terraform (0.11.7).
Here the full error log:
|
I regret the useless error message. This happens when (a) PyHCL fails to parse a terraform config (unlikely), (b) when a module is pulled in from a source blast-radius doesn't know how to handle, or (c) some unknown/uncharacterized condition. Hopefully (b), since it offers the easiest path to resolution :) Does this configuration pull modules from anywhere interesting (ie not the local filesystem?) Thanks, |
Ahh that makes sense. Yes, I tried a few different configurations and they both use modules from the "terraform module registry". Their source is something like So if I make local copies of those on the file system, it may work? Thanks for the quick reply! |
Yes--or add another condition here. I'm reluctant to try a patch from mobile, but otherwise happy to commit tomorrow. That whole block needs to be reconciled with the various module sources Terraform supports. Regret the hassle :) |
That great news, thanks! No hurries on the commit, as I don't need to create a chart until later next week. I might also replace the module with direct resources as it may simplify the dependency chart. While I have you here - I do have a feature request (I can move this to a separate issue if you want)
Thanks again for the quick response & triage. |
@robertpeteuil that makes a lot of sense, thanks for supplying a use case :) I'm thinking, additionally, of using a split-dropdown component, so that you can disable/re-enable tooltips in a single click. |
Thanks for the commit! I'll test this out in the next couple of days with some of my more complex configurations. The split-dropdown component sounds awesome.
|
I get this error too: [2018-07-04 16:27:04,222] ERROR in app: Exception on /graph.json [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/src/blastradius/server/server.py", line 57, in graph_json
tf = Terraform(os.getcwd())
File "/src/blastradius/handlers/terraform.py", line 57, in __init__
self.modules[name] = Terraform(directory=self.directory+'/'+source, settings=mod)
File "/src/blastradius/handlers/terraform.py", line 26, in __init__
self.config = hcl.load(config_io)
File "/usr/local/lib/python3.6/dist-packages/hcl/api.py", line 51, in load
return loads(fp.read())
File "/usr/local/lib/python3.6/dist-packages/hcl/api.py", line 61, in loads
if isHcl(s):
File "/usr/local/lib/python3.6/dist-packages/hcl/api.py", line 39, in isHcl
raise ValueError("No HCL object could be decoded")
ValueError: No HCL object could be decoded
172.17.0.1 - - [04/Jul/2018 16:27:04] "GET /graph.json HTTP/1.1" 500 - |
Hi, the docker image used to be working fine for me a few weeks ago, but now the visualization fails with the following error when I run it against the same codebase in same PC:
|
Huh. My first thought was something different about PyHCL, or PLY, but it doesn't look like PyHCL has updated since February 2018 https://pypi.org/project/pyhcl/#history (and it locks the PLY version). It would be helpful to narrow down the file and line # where the error is encountered. The following should do the job... Presumes pyhcl is installed:
Then from a script or python shell:
|
@28mm seeing this issue arise on docker as a first time user. Tried to install the packages via pip and that was hitting a separate error. Looks like a great little package. Here's the output that I have from the cmd above...
I'm using a customized derivative of |
Running with
|
…8mm#71: work around pyhcl virtuald/pyhcl#55: pyhcl doesn't support terraform v0.12 Resolve this temporarily by using the go library `hcl2json` which allows colorization and rendering to still work. JSON references don't appear to work, but the package is still usable. Add pipenv support and update documentation and Makefile to support the external go package.
I get the following error with blast-radius 0.1.12:
172.17.0.1 - - [23/Mar/2018 14:22:37] "GET / HTTP/1.1" 200 -
172.17.0.1 - - [23/Mar/2018 14:22:42] "GET /graph.svg HTTP/1.1" 200 -
[2018-03-23 14:22:44,757] ERROR in app: Exception on /graph.json [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "/src/blastradius/server/server.py", line 57, in graph_json
tf = Terraform(os.getcwd())
File "/src/blastradius/handlers/terraform.py", line 26, in init
self.config = hcl.load(config_io)
File "/usr/local/lib/python3.6/dist-packages/hcl/api.py", line 51, in load
return loads(fp.read())
File "/usr/local/lib/python3.6/dist-packages/hcl/api.py", line 62, in loads
return HclParser().parse(s)
File "/usr/local/lib/python3.6/dist-packages/hcl/parser.py", line 307, in parse
return self.yacc.parse(s, lexer=Lexer())
File "/usr/local/lib/python3.6/dist-packages/ply/yacc.py", line 331, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/local/lib/python3.6/dist-packages/ply/yacc.py", line 1199, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "/usr/local/lib/python3.6/dist-packages/ply/yacc.py", line 193, in call_errorfunc
r = errorfunc(token)
File "/usr/local/lib/python3.6/dist-packages/hcl/parser.py", line 300, in p_error
raise ValueError(msg)
ValueError: Line 628, column 22458: unexpected RIGHTBRACE
172.17.0.1 - - [23/Mar/2018 14:22:44] "GET /graph.json HTTP/1.1" 500 -
A debug mode would be helpful for finding the file that the parser doesn't like. Terraform plan/apply works fine so it's happy with the HCL blast-radius is parsing.
The text was updated successfully, but these errors were encountered: