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

Miq Expression execution fails with operator token not supported #16514

Closed
mkanoor opened this issue Nov 21, 2017 · 6 comments
Closed

Miq Expression execution fails with operator token not supported #16514

mkanoor opened this issue Nov 21, 2017 · 6 comments
Assignees

Comments

@mkanoor
Copy link
Contributor

mkanoor commented Nov 21, 2017

The following MiqExpression built from Automate Methods on a custom attribute causes a failure at execution time.

The :token is added during expression substitution

{"="=>{"field"=>"ExtManagementSystem-emstype_description", "value"=>"ManageIQ::Providers::Amazon::CloudManager"}, :token=>1}

The :token is added during expression substitution.

If the expression cannot be handled by SQL we end up deleting the expression but leave the :token key in the hash and when it comes to resolve the next piece it sees :token as an invalid operator and raises an exception. If we delete the expression because it cannot be handled we also need to delete the associated :token key.
https://github.com/ManageIQ/manageiq/blob/master/lib/miq_expression.rb#L315

@mkanoor
Copy link
Contributor Author

mkanoor commented Nov 21, 2017

@gtanzillo @imtayadeway
Please review

@imtayadeway
Copy link
Contributor

The :token is added during expression substitution

@mkanoor can you elaborate on where/why this is happening?

@mkanoor
Copy link
Contributor Author

mkanoor commented Nov 22, 2017

@imtayadeway
Expressions can be built with static data or they can be filled in at runtime by the user. The UI prompts the user for the fields and that substitutes the values into the expression which is then evaluated. An expression which has run time substitution looks like this

{"="=>{"field"=>"Flavor.ext_management_system-id", "value"=>:user_input}, :token=>1}

When the substitution happens user_input is replaced with the runtime value, but the :token is not removed.

This all works fine if the expression only contains SQL table columns, if the expression contains a custom attribute or virtual column then the check for sql column ends up deleting the first half of the expression leaving the token in the key and tripping on the :token

@yrudman
Copy link
Contributor

yrudman commented Apr 27, 2018

#17215 should resolve this issue

@mkanoor
Copy link
Contributor Author

mkanoor commented Apr 27, 2018

Fixed with #17215

@yrudman
Copy link
Contributor

yrudman commented Aug 21, 2019

issue was not fully resolved,
PR to resolve it when actual expression contain custom attribute: #19176

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

3 participants