Commit Graph

13 Commits

Author SHA1 Message Date
Q.hongtao 4bc6162515 Remove six library
Remove six-library Replace the following items with Python 3 style code.
- six.interger_types
- six.itervalues
- six.text_type
- six.string_types
- six.StringIO
- six.next
- six.b
- six.PY3

Change-Id: I299c90d5cbeb41be0132691265b8dcbeae65520e
2020-09-23 10:27:12 +08:00
Renat Akhmerov 592981f487 Refactor expressions
* This patch moves code related to YAQL and Jinja into their
  specific modules so that there isn't any module that works with
  both. It makes it easier to understand how code related to one
  of these technologies works.
* Custome built-in functions for YAQL and Jinja are now in a
  separate module. It's easier now to see what's related with
  the expression framework now and what's with integration part,
  i.e. functions themselves.
* Renamed the base module of expressions similar to other packages.
* Other style changes.

Change-Id: I94f57a6534b9c10e202205dfae4d039296c26407
2020-02-26 12:36:34 +07:00
Vitalii Solodilov e1f105685a Fixed Jinja error handling
Before changes `cls._env.from_string(expression).render(**ctx)` can
raise exception, for example the variable doesn't exist. And this
exception is not handled.
Jinja error handling was moved to cover this case.

Change-Id: Ib020550d0ec989ca382b738844a752ec9d02919a
Closes-bug: #1743649
Signed-off-by: Vitalii Solodilov <mcdkr@yandex.ru>
2018-04-23 14:02:34 +04:00
Renat Akhmerov bb0f9f9fd1 Re-raise DB errors when evaluating expressions
* See details in the bug description

Change-Id: Id8c00c5d1196b72c08aa1d518b25a08290868693
Closes-Bug: #1729582
2017-11-03 11:24:29 +07:00
Nick Maludy 10b27fcdea Fixes issue rendering strings containing multiple jinja expressions
Closes-Bug: #1712133
Change-Id: I058e9858e4a4a9a94e0948df38758446e68bf5b9
2017-09-09 11:59:49 -04:00
Istvan Imre ff78d7f659 Dynamic workflow name evaluation.
Evaluate workflow names dynamically, so yaql or jinja expression
is allowed as sub-workflow name. Tasks names are not yet
dynamically evaluated.

Partially implements: blueprint mistral-dynamic-actions

Change-Id: Icfe591e27a4f45c2e3dcfa83512217f3b2122189
2017-08-16 13:17:10 +02:00
Sharat Sharma b38dceec50 Add a hacking rule for string interpolation at logging
From [1], string interpolation should be delayed to be handled by
the logging code, rather than being done at the point of the logging
call. Add a hacking rule, [M331], to delay the string interpolation.

[1] https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages
Change-Id: Ibf0ac960ae84e935979f93f3a0dec8d774aade78
Closes-Bug: #1705634
2017-07-26 11:13:15 +00:00
Xavier Hardy fc12891256 Use Jinja2 sandbox environment
Jinja2 non-sandbox environment is unsafe as it gives
access to unsafe Python methods

Change-Id: If8a96bb92f64c4226a3d02e3cf6e0dcb0e9156fd
Closes-Bug: #1680112
2017-04-10 15:36:23 +02:00
Lingxian Kong b563e5898f Trim yaql/jinja operation log
Only keep the top level validation/evaluation log is enough for
debugging.

Change-Id: I22d18aeeafcf68aaa6f55da1c943b282f001ef82
2017-03-22 11:08:03 +13:00
Istvan Imre 5267e1eb1c Invalid jinja pattern regex corrected
Due to this invalid regex it is not possible to run workflows
with Jinja2 expressions in some python2 environment.

Change-Id: I3d8fe9a617d5e3f916a8c102d0408354064b766c
Closes-bug: #1658958
2017-01-24 11:26:08 +01:00
Renat Akhmerov 764f5298dc Make Jinja evaluator catch and wrap all underlying exceptions
Change-Id: Ie45dcc51519a839a0983860711cba48fa4a112a1
Closes-Bug: 1642574
2016-11-18 17:11:54 +07:00
Renat Akhmerov 91068b5f08 Change format of YAQL errors
* See the bug for details
* Style changes in Jinja expressions module

Partial-Bug: #1630473
Change-Id: Iad0720ce33aeefb99cc20d102535498203deb3d4
2016-10-19 17:46:51 +07:00
Kirill Izotov 362c2295e8 Add Jinja evaluator
Allows to use Jinja instead of or along with YAQL for expression
evaluation.

 * Improved error reporting on API endpoints. Previously, Mistral API
   tend to mute important logs related to errors during YAML parsing
   or expression evaluation. The messages were shown in the http
   response, but would not appear in logs.

 * Renamed yaql_utils to evaluation_utils and added few more tests to
   ensure evaluation functions can be safely reused between Jinja and
   YAQL evaluators.

 * Updated action_v2 example to reflect similarities between YAQL and
   Jinja syntax.

Change-Id: Ie3cf8b4a6c068948d6dc051b12a02474689cf8a8
Implements: blueprint mistral-jinga-templates
2016-10-05 11:27:29 +00:00