-
Notifications
You must be signed in to change notification settings - Fork 898
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
[WIP] Miq expression interp #22989
base: master
Are you sure you want to change the base?
[WIP] Miq expression interp #22989
Conversation
I did a little spelunking, and in 2008 @gtanzillo (Hi Greg!) introduced Maybe @gtanzillo can remember anything here on this old format? Even so, I'd be super-surprised if @ vmdb/product/policies/env_prod_vm_host.yml:7 @ modifier: "allow"
who: "system"
what: "start"
rule:
- mode: "tag_expr"
- expr: |-
- <exist ref=host>/managed/environment/prod</exist> &&
- <exist>/managed/environment/prod</exist>
+ mode: "tag_expr_v2"
+ expr:
+ and:
+ - exist:
+ field: Host.managed-environment
+ value: prod
+ - exist:
+ field: Vm.managed-environment
+ value: prod |
6c76520
to
e8cf212
Compare
5f7d944
to
f14210c
Compare
f14210c
to
526e08b
Compare
update:
|
…s, value) basically just moving up the type checking to the method caller This changes the method interface so we can pass in a field object instead of calling col_details
use that value when converting datatype
converge value_in_sql and field_in_sql
still work even if :token is the first key in the exp still process find sub targets this gets us more values with field-field
Think this was the only reference to MiqExpressoin#valid?
526e08b
to
ddf4470
Compare
Checked commits kbrock/manageiq@4150ce6~...ddf4470 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint lib/miq_expression.rb
|
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
parent:
Made some progress
I wanted to see what our code looks like for preprocessing the whole tree up front. The code was parsing the same fields over and over for to_ruby. The thought is if to_ruby has all the data it needs, then an interpreter will have all the data it needs.
col_details
and just use the cached field value from the preprocessorThere are still a few places to remove more
Field.parse
calls, but seems good enough.From here we want to transition focus on
Condition.subst
.This is where we spend the most of our time and create the most objects.
If we can verify that we don't use
mode="tag_expr"
, then we can avoid the_to_ruby.gsub() { _subst}.gsub() { _subst }
code and have theto_ruby
produce the correct code in the first place.@Fryguy do you know anything about
mode="tag_expr"
and if we would have customers still using that?