The Wayback Machine - https://web.archive.org/web/20200919063545/https://github.com/Skyscanner/cfripper/issues/101
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

Unhandled exception when template file is empty #101

Open
jscruz opened this issue Jan 28, 2020 · 1 comment
Open

Unhandled exception when template file is empty #101

jscruz opened this issue Jan 28, 2020 · 1 comment

Comments

@jscruz
Copy link

@jscruz jscruz commented Jan 28, 2020

Hi,

I found a minor issue when running cfripper with a list of files. I had a blank file in that list and there was an exception. The exception helped to understand something was wrong but it would be good if cfripper check the validity of the CF file first before throwing an exception.

Please find the steps to reproduce below:

Steps to reproduce:

Create a blank file:

touch example.yml

Execute cfripper:

cfripper example.yml

Exception is raised:

Analysing example.yml...
Unhandled exception raised, please create an issue wit the error message at https://github.com/Skyscanner/cfripper/issues
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/cfripper/cli.py", line 151, in cli
    process_template(template=template, resolve_parameters=resolve_parameters, **kwargs)
  File "/usr/lib/python3.8/site-packages/cfripper/cli.py", line 90, in process_template
    cfmodel = get_cfmodel(template)
  File "/usr/lib/python3.8/site-packages/cfripper/cli.py", line 39, in get_cfmodel
    cfmodel = pycfmodel.parse(template)
  File "/usr/lib/python3.8/site-packages/pycfmodel/__init__.py", line 19, in parse
    return CFModel(**template)
TypeError: ModelMetaclass object argument after ** must be a mapping, not NoneType

I think it should be great if cfripper handles the error outputting a message like:

Analysing example.yml...
example.yml is not a valid template.

Thanks!

@jsoucheiron
Copy link
Contributor

@jsoucheiron jsoucheiron commented Jan 28, 2020

Makes sense, we'll fix it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.