There was a logical flaw where we compared types
that were different causing a TypeError.
There was also a flaw in that we default to the
name of the action when sorting if the key does
not exist, to compare the data both value should
come from the same key as well otherwise they
should be treated as not equal since the data
cannot be.
Change-Id: Idcb276912582bb097dc5c1c9692facde63d5886b
* This patch refactors Mistral with the action provider concept
that is responsible for delivering actions to the system. So
it takes all the burden of managing action definitions w/o
having to spread that across multiple subsystems like Engine
and API and w/o having to assume that action definitions are
always stored in DB.
* Added LegacyActionProvider that represents the old way of
delivering action definitions to the system. It pretty much just
analyses what entries are configured in the entry point
"mistral.actions" in setup.cfg and build a collection of
corresponding Python action classes in memory accessible by names.
* The module mistral/services/actions.py is now renamed to
adhoc_actions.py because it's effectively responsible only for
ad-hoc actions (those defined in YAML).
* Added the new entry point in setup.cfg "mistral.action.providers"
to register action provider classes
* Added the module mistral/services/actions.py that will be a facade
for action providers. Engine and other subsystems will need to
work with it.
* Other small code changes.
Depends-On: I13033253d5098655a001135c8702d1b1d13e76d4
Depends-On: Ic9108c9293731b3576081c75f2786e1156ba0ccd
Change-Id: I8e826657acb12bbd705668180f7a3305e1e597e2
added namespace for the actions, actions can have the same name if they
are not in the same namespace, when executing an action, if an action
with that name is not found in the workflow namespace or given
namespace mistral will look for that action in the default namespace.
* action base can only be in the same namespace,or in the
default namespace.
* Namespaces are not part of the mistral DSL.
* The default namespace is an empty string ''.
* all actions will be in a namespace, if not specified, they will be
under default namespace
Depends-On: I61acaed1658d291798e10229e81136259fcdb627
Change-Id: I07862e30adf28404ec70a473571a9213e53d8a08
Partially-Implements: blueprint create-and-run-workflows-within-a-namespace
Signed-off-by: ali <ali.abdelal@nokia.com>
This change intends to add the following policies:
- actions:publicize
- workflows:publicize
A refactor of the policy tests is included to increase the coverage.
Change-Id: I8bd637f7de63f02c63f3c304cb6f5198fc0c5f42
Closes-Bug: 1779293
Everywhere the DB API is used, errors related to DB connectivity,
deadlocks or similar operational errors can happen. In order to
compensate this, all DB API calls are surrounded by the same retry
logic that matches the REST requirements (reasonable response time,
service specific error message)
Change-Id: I24227e1a763114b9895ac8901b7096445b7df77f
Changed all calls to log.info on the RestControllers to debug
This due to a feedback on working on a issue that the logging info was leaking
sensitive content from the env.
That data makes sense to be logged only for debug level
Envs can have up to 2GB so I added a cut to it
Change-Id: If1b71590c0904182bb8052c3e942131e57494825
Closes-Bug: #1714236
To prevent possible failures because of operational errors
we should add retries and send additional requests to the
database.
This change will increase the overall stability of the system
and will avoid obscure errors from the database.
Change-Id: I9ddef565acabbbfaddcb96f6a850a21875e6dcd5
Closes-bug: #1730426
Some of the docstrings didn't include param definitions. This made
the generated docs not match up types correctly. This should fix
that.
Change-Id: I3f4a60908b78f628481e63d06cf6433dd3206a2e
Depends-On: Ia93fd13645830cd8994ef283b72f31cb22cf3fe9
* Using method from_db_model() of REST resources where possible
which is more efficient than from_dict() that requires one more
object in memory (a dict)
* Minor style changes
Change-Id: Ie1f3137bee94328f2af676a0831e30c1cf212f47
* The previous name of the package is not relevant anymore, it was
chosen for reasons that don't make sense anymore. A name of the
package should reflect that it's about the workflow language.
Change-Id: I7e05ba97abf0aa5db4e19d9d72b4ea0d52e328fb
String interpolation should be delayed to be handled by the logging
code,rather than being done at the point of the logging call.
Ref:http://docs.openstack.org/developer/oslo.i18n/guidelines.html#log-translation
For example:
# WRONG
LOG.info(_LI('some message: variable=%s') % variable)
# RIGHT
LOG.info(_LI('some message: variable=%s'), variable)
Change-Id: I86a136c2221d20b2319e7876f1986ba10536853e
* Task result should be not be included when a collection of
task executions is requested because: 1) practically result
of individual task may be long 2) in order to extract it we
have to query action executions for every task execution,
the result operation becomes extremely heavy even for small
data sets. If task result is needed it should be requested
individually. This behavior was broken during the recent
refactoring in API layer.
* Other minor changes
Change-Id: I46697e24d826bd2b705ca61b188e9bed66888876
Also added some database tests for get and delete action
definition by id.
Change-Id: I71dde2b91423ba1850653a076e241787d1f79572
Partially-Implements: blueprint mistral-actions-identifier
- Support name and id to access via GET /v2/actions/
- Support name and id to access via DELETE /v2/actions/
TODO:
- Make other apis of database layer consistent with
workflow and action api.
- Support name and id to access via PUT /v2/actions/
Change-Id: I8ce55c0eb1cab7581ba719fbbb6be7b7dced27e0
Implements: blueprint mistral-actions-identifier
Closes-Bug: #1584643
The API called create_or_update_action_definition when doing a PUT
request. This was incorrect, as updating an action that doesn't
exist shouldn't create a new action - rather a 404 is expected.
This change adds a new create_or_update_actions method that has
has the previous behaviour and updates the action_manager.py to
use this as it required the old behaviour. The update_actions
method is then updated to use the DB API call that will error if
the action doesn't exist.
Change-Id: Iea9ce71078058224172d31e20d84746052a28b2f
Closes-Bug: 1568541
Mistral api access can be restricted base on role
by modifying /etc/mistral/policy.json file.
Change-Id: I4c78ca4cc04d25f46aea55948bce339cfe460ff0
Implements: blueprint mistral-customize-authorization
While technically accurate, it was returning a string, it would
be good to explicitly state that it is a JSON string.
Change-Id: I8527395bf99f92105027e2e8aeb54a0e5f7dc02d
Add an API that gets an ad-hoc action DSL and validates it.
This is done in the same way workflows are validated today.
Change-Id: Ibbb949ef38befae1ef83a2a56cda4c817ceb41d4
Implements: blueprint validate-ad-hoc-action-api
Add query params for action list REST API:
* limit: return a maximun number of items at a time, default is None, the
query result will include all the resource items, which is backward
compatible.
* marker: the ID of the last item in the previous list.
* sort_keys: columns to sort results by. Default: name, which is backward
compatible.
* sort_dirs: directions to sort corresponding to sort_keys, "asc" or
"desc" can be choosed. Default: asc. The length of sort_dirs can
be equal or less than that of sort_keys.
Change-Id: Ied5b48244cc94a3039ebafce40f3c2ae25f9a48e
Partially-Implements: blueprint mistral-pagination-support
* use oslo.log for logging functionality
* get rid of the file /mistral/openstack/common/log.py
Implements: blueprint mistral-log-enhancement
Partial-Bug: #1459188
Change-Id: I6b62cffda0a20b6caf59cc30bcc33c21ae1e5898
* Created a Execution hierarcy mapped on a single table:
- ActionExecution
- WorkflowExecution
- TaskExecution
* Created necessary associations within Execution hierarchy
* Created necessary methods for Execution objects on DB API
* Created Definition hierarchy mapped on separate tables:
- Workbook
- WorkflowDefinition
- ActionDefinition
* Renamed attributes
- 'wf_name' -> 'workflow_name'
- 'wf_spec' -> 'spec'
* Fixed all unit tests
TODO:
* Complete renaming throughout the code
* Further refactoring of workflow engine
Change-Id: I0032bea573d9200025f9f7dd951e93cb6f1661bb
* Use YAML text instead of JSON for workbooks,
workflows and actions in HTTP body.
* Use hook for validating Content-Type
* Changed pecan dependency on pecan>=0.8.0 due to
hook bug in pecan v0.6.0
Implements blueprint mistral-yaml-request-body
Change-Id: I5a55aa438faeca42385e8e25770bce00da2e93a9
* Added action service similar to workflow service
* Added ActionListSpec to represent a top level action list
* Changed action controller to call action service properly
* Added required unit tests
* Other minor changes
Change-Id: Iebbefab6168cdc167e5c2d9ad7fe806d431f0cef
* Added all needed to implement endpoint /actions
* Unit tests
* New method in workbook parser to load action spec from YAML
Change-Id: Ifac321247812c564957ba4602d75b34e759c7670