-
Notifications
You must be signed in to change notification settings - Fork 922
Update cel-python usage #2015
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
base: master
Are you sure you want to change the base?
Update cel-python usage #2015
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the usage of the cel-python library by modifying how context is passed to the evaluator. The change moves context from being passed during activation creation to being passed during evaluation execution.
- Updates CEL evaluator instantiation to pass context during evaluation rather than activation
- Modifies the parameter passing pattern in the cel_field_presence module
@@ -41,6 +41,6 @@ def macro_has_eval(self, exprlist): | |||
_has_state.in_has = False | |||
return result | |||
|
|||
e = Evaluator(ast=self.ast, activation=self.new_activation(context), functions=self.functions) | |||
value = e.evaluate() | |||
e = Evaluator(ast=self.ast, activation=self.new_activation(), functions=self.functions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new_activation() method is being called without the context parameter that was previously passed. Verify that this method can handle being called without parameters and that the context will be properly available when passed to evaluate().
e = Evaluator(ast=self.ast, activation=self.new_activation(), functions=self.functions) | |
e = Evaluator(ast=self.ast, activation=self.new_activation(context), functions=self.functions) |
Copilot uses AI. Check for mistakes.
What
Fix usage of cel-py as some breaking changes were introduced in 0.4.0: cloud-custodian/cel-python#118
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups