Commit Graph

46 Commits

Author SHA1 Message Date
Vadim Zelenevsky cadfe9dca2 Fix maintence mode
Added MaintenceHook to app configuration
Refactored maintence service
Fixed sql queries
Fix maintence controller

Closes-Bug: #2058009
Signed-off-by: Vadim Zelenevsky <wortellen@gmail.com>
Change-Id: Ica41e8208b29aeba6e781801540843d46375c3d1
2024-04-08 07:24:41 +00:00
Zuul c9bd45d073 Merge "Add "fields" filter support on single objects" 2023-02-09 13:06:08 +00:00
Tobias Urdin b6a47992e7 Fix sorting error when type is different
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
2023-01-18 21:20:28 +01:00
Xavier Hardy 9c5324ce9a Add "fields" filter support on single objects
Change-Id: Iba0401445921f9ea7932628c05590472307ba83a
Closes-Bug: #1718214
Signed-off-by: Xavier Hardy <xavier.hardy@corp.ovh.com>
Co-Authored-By: Oleg Ovcharuk <vgvoleg@gmail.com>
Signed-off-by: Oleg Ovcharuk <vgvoleg@gmail.com>
2022-12-21 06:40:50 +00:00
Tobias Urdin 1a6f5d0e5f Added sorting and marker for pagination of actions
This solves the sorting and marker for pagination
when listing actions.

Change-Id: I9bb15642585af22ad354dd4f8f2253a47129639e
2022-08-15 08:07:13 +00:00
Renat Akhmerov 06a0f33476 Refactor Mistral with Action Providers
* 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
2020-09-24 11:10:33 +00:00
ali 20c3408692 Add namespaces to Ad-Hoc actions
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>
2020-01-07 08:10:53 +00:00
Pierre Gaxatte 522f388709 Add a policy to control the right to publish resources
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
2018-07-05 11:46:52 +02:00
Kevin Pouget 8d14c3ebc6 Add missing query paramater `scope` to the workbook api
Change-Id: I4f2ef1fcaa5a0b0e931319178f6cc5bae96e8fc3
Closes-Bug: #1757499
2018-06-27 14:18:39 +00:00
Andras Kovi f0b5196566 Improve Mistral API DB error handling
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
2018-03-25 19:36:56 +02:00
Adriano Petrich 9a1dd2902e Change log level for RestControllers
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
2017-12-14 10:19:40 +00:00
Mike Fedosin bff3ebf30b Add retries to read-only db operations
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
2017-11-07 13:20:28 +03:00
Brad P. Crochet d57e98d0b9 Cleanup docs to include params
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
2017-07-21 12:29:25 +00:00
Renat Akhmerov 289273235d Optimize API layer: using from_db_model() instead of from_dict()
* 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
2017-05-22 12:03:17 +07:00
Renat Akhmerov 5c140a2fce Rename package 'workbook' to 'lang'
* 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
2017-03-06 15:41:37 +07:00
Xavier Hardy 28d1675828 Fix missing exception decorators in REST API
Change-Id: Ifbc0582c6339bc2c94b3e8f9cd13af6d17f55a40
2016-11-09 17:31:59 +01:00
zhangyanxian 4e5ca383bc Adding Variables to Log Messages
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
2016-11-07 02:03:34 +00:00
hardik eebe77b20f Filtering support for actions
TODO: Add more tests.

Change-Id: I110c2073b82c4ffb3a1f02e152937451395a1e87
Implements: blueprint mistral-items-filtering
2016-08-11 09:38:55 +00:00
Jenkins 001598237c Merge "Allow to use both name and id to update action definitions" 2016-07-29 04:59:35 +00:00
Renat Akhmerov 0463e78dde Remove task result for collection REST requests
* 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
2016-07-26 22:40:26 +07:00
hardik c3e776e10a Allow to use both name and id to update action definitions
Also added some database tests for get and delete action
definition by id.

Change-Id: I71dde2b91423ba1850653a076e241787d1f79572
Partially-Implements: blueprint mistral-actions-identifier
2016-07-25 17:40:17 +05:30
Renat Akhmerov 7f5335dd38 Move REST resources action, action execution and task to resources.py
Change-Id: Id5898405becd8c8f9ce4784a0a1d8d80dc77835d
2016-07-21 14:51:50 +07:00
Marcos Fermin Lobo 0d8a3a8c64 Allow to use both name and id to access action definitions
- 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
2016-07-21 03:07:22 +00:00
Jenkins 5437ad417f Merge "Add filters to all collections listing functions (tags included)" 2016-07-06 12:21:49 +00:00
Xavier Hardy 843df14e0f Add filters to all collections listing functions (tags included)
Change-Id: I9c4880a41af0a79d8285a4ad23af453ba81c28bc
Partial-Bug: #1585646
2016-07-06 10:18:55 +02:00
Dougal Matthews 7b773bba05 Don't create actions when attempting to update one that doesn't exist
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
2016-07-01 13:19:42 +01:00
Jenkins 2e8b36d825 Merge "Fix API inconsistencies with GET /v2/workflows" 2016-06-21 10:17:54 +00:00
Xavier Hardy 0e51d26e1c Fix API inconsistencies with GET /v2/workflows
Add missing API parameters to Workbooks, Actions, Executions, Cron
Triggers, Environments, Action Executions and Tasks:
marker, limit, sort_keys, sort_dirs, fields, filters

Change-Id: I207bc93e84067f83f926843f0b9895a19b831079
Partial-Bug: #1585646
2016-06-21 09:28:33 +02:00
Jenkins 02663c97ac Merge "Rename the to_string method to to_json to clarify it's purpose" 2016-06-15 05:28:31 +00:00
hardik 11e443efeb Added role base authentication support
Mistral api access can be restricted base on role
by modifying /etc/mistral/policy.json file.

Change-Id: I4c78ca4cc04d25f46aea55948bce339cfe460ff0
Implements: blueprint mistral-customize-authorization
2016-06-14 05:15:00 +00:00
Dougal Matthews e15fba5967 Rename the to_string method to to_json to clarify it's purpose
While technically accurate, it was returning a string, it would
be good to explicitly state that it is a JSON string.

Change-Id: I8527395bf99f92105027e2e8aeb54a0e5f7dc02d
2016-06-09 20:13:33 +01:00
Michal Gershenzon 594b3e27f9 Add API to validate ad-hoc action
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
2016-05-18 11:02:59 +00:00
Zhao Lei 0f140c7b96 Fix some spelling typo in manual and program output
Fixed following typos.
 infomation -> information
 initilization -> initialization
 intialize -> initialize
 compatability -> compatibility
 compatability -> compatibility
 quering -> querying
 initilization -> initialization
 infomation -> information
 incomming -> incoming

Also fixed some small typo in source comment.

Change-Id: I381aed76094f19f8ef7e821e965fafb0dfe900b2
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
2015-09-24 21:10:36 +08:00
Nikolay Mahotkin ddf30354ae Fixing uploading public workflow or action
Closes-Bug: #1470373

Change-Id: I776d10e8c3303e6c7d6430a0f338d6f6cbb255a9
2015-09-16 17:30:05 +03:00
kong 9f95f3775f Add pagination support for actions query 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
2015-08-20 13:26:57 +08:00
LingxianKong a674853d62 Make use of graduated oslo.log module
* 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
2015-06-09 17:38:19 +08:00
Renat Akhmerov bdefdc6a6f Refactoring task output: full redesign of DB models
* 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
2015-03-03 16:50:55 +06:00
Lakshmi Kannan 3c5ed88088 API controllers should log requests at INFO level
Closes-Bug: 1401688

  * Change all instances of LOG.debug to LOG.info in API controllers.

Change-Id: Ia7e81896b7f40a99c47a999582c87afe0e1b3fda
2014-12-11 14:35:25 -08:00
Nikolay Mahotkin b85c37b1c1 Use YAML text instead of JSON in HTTP body
* 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
2014-11-26 12:59:39 +03:00
Dmitri Zimine b8390eb84d Add documentation - part 3
Document REST v2 with autodocs

Change-Id: Ib43d2237ebb0f8ef9f8d18e70182d7cc5f2f0828
2014-10-16 20:45:39 -07:00
Nikolay Mahotkin 412f5ced97 Provide action-input via API
Change-Id: I87a39fde113c98008c03183a9d3402b4b1173d07
2014-10-06 13:20:16 +04:00
Nikolay Mahotkin c7ae19e6fa Fix providing 'is_system' property in /actions
Fixes-bug: #1373748

Change-Id: I596bcaa86cc2272bb22c272fbf293c0e3fb9fba6
2014-09-30 07:16:36 +00:00
Renat Akhmerov 7c406e4cbc Adding 'tags' to action rest resource
Change-Id: I197f7dc1d97188c3bc9f6f3089bd29877bf6fa3c
2014-09-25 15:33:54 -07:00
Renat Akhmerov e30415ef37 Making action controller able to handler multiple actions
* 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
2014-09-23 18:51:55 +04:00
Renat Akhmerov 8786f3a9cd Saving description from definition in actions endpoint
Change-Id: Ic0921c4e447bf5c3dd67be5b274eeaee93678e3d
2014-09-11 15:34:03 +07:00
Renat Akhmerov 9a671cf7cb Adding actions endpoint
* Added all needed to implement endpoint /actions
* Unit tests
* New method in workbook parser to load action spec from YAML

Change-Id: Ifac321247812c564957ba4602d75b34e759c7670
2014-09-11 03:28:21 +00:00