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

Exception thrown when assertions used #3667

Closed
bgardner-noggin opened this issue Sep 6, 2024 · 2 comments
Closed

Exception thrown when assertions used #3667

bgardner-noggin opened this issue Sep 6, 2024 · 2 comments

Comments

@bgardner-noggin
Copy link

CloudFormation Lint Version

1.12.3

What operating system are you using?

Fedora

Describe the bug

Exception is thrown trying to validate a template with assertions

Traceback (most recent call last):
  File "/home/local/bgardner/.local/bin/cfn-lint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/runner.py", line 452, in main
    runner.cli()
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/runner.py", line 443, in cli
    self._cli_output(list(self.run()))
                     ^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/runner.py", line 395, in run
    yield from self._validate_filenames(self.config.templates)
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/runner.py", line 299, in _validate_filenames
    yield from self.validate_template(filename, template)  # type: ignore[arg-type] # noqa: E501
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/runner.py", line 321, in validate_template
    runner = TemplateRunner(filename, template, self.config, self.rules)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/runner.py", line 98, in __init__
    self.cfn = Template(filename, template, self.config.regions)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/template/template.py", line 78, in __init__
    self.conditions = cfnlint.conditions.Conditions(self)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/conditions/conditions.py", line 40, in __init__
    self._cnf, self._solver_params = self._build_cnf(list(self._conditions.keys()))
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/conditions/conditions.py", line 185, in _build_cnf
    cnf.add_prop(rule.build_cnf(equal_vars))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/conditions/_rule.py", line 143, in build_cnf
    return self._assertions.build_cnf(params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/local/bgardner/.local/lib/python3.11/site-packages/cfnlint/conditions/_rule.py", line 94, in build_cnf
    return And(*assertions)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sympy/core/operations.py", line 512, in __new__
    _args = frozenset(cls._new_args_filter(args))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sympy/logic/boolalg.py", line 606, in _new_args_filter
    args = BooleanFunction.binary_check_and_simplify(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sympy/core/operations.py", line 505, in <genexpr>
    args = (_sympify_(arg) for arg in args)
            ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sympy/core/sympify.py", line 529, in _sympify
    return sympify(a, strict=True)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sympy/core/sympify.py", line 388, in sympify
    raise SympifyError(a)
sympy.core.sympify.SympifyError: SympifyError: None

Expected behavior

No exception thrown

Reproduction template

Parameters:
    Foo:
        Type: String
Rules:
    Recreate:
        Assertions:
          - Assert: !Equals [ !Ref Foo, 'Yes' ]
            AssertDescription: "Test"
@kddejong
Copy link
Contributor

kddejong commented Sep 6, 2024

fixed with #3663. Waiting on release.

@kddejong
Copy link
Contributor

kddejong commented Sep 6, 2024

Released

@kddejong kddejong closed this as completed Sep 6, 2024
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