distcloud/distributedcloud/dcorch/api
Lindley Werner c5e1d7c131 Fix load-import --local with proxy
When load-import is called with --local the load is imported locally
from the active controller. When it's called with "--os-region-name
SystemController", the request is intercepted by the dc-api-proxy.

This commit fixes a bug that happens when the request is intercepted
by the dc-api-proxy. When using --local, the function receives the
params through "request.body" and when not using it the params come
through request.POST. Only the second way was being treated.

Test plan:
  PASS: load-import with --os-region-name SystemController,
  --inactive and --local should be completed if using an upgradable
  load
  PASS: load-import with --os-region-name SystemController,
  --inactive and --local should fail if using a non-upgradable load
  PASS: load-import with --os-region-name SystemController, --active,
  and --local should complete using a load from the same version
  PASS: load-import with --os-region-name SystemController and
  --inactive should be completed if using an upgradable load
  PASS: load-import with --os-region-name SystemController and
  --inactive should fail if using a non-upgradable load

Closes-bug: 2043511

Change-Id: Id5c02fdc35c43b4134fd34592de36d35f9fc88b6
Signed-off-by: Lindley Werner <Lindley.Vieira@windriver.com>
2023-11-14 18:54:25 -03:00
..
controllers Minor Code Change Based on Py39 Pylint Feedback 2022-08-10 13:12:24 -04:00
policies Implement access control for DC API 2022-09-22 18:26:35 -03:00
proxy Fix load-import --local with proxy 2023-11-14 18:54:25 -03:00
__init__.py Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
api_config.py Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
app.py Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
policy.py Implement access control for DC API 2022-09-22 18:26:35 -03:00
README.rst Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00

api

DC Orchestrator API is Web Server Gateway Interface (WSGI) applications to receive and process API calls, including keystonemiddleware to do the authentication, parameter check and validation, convert API calls to job rpc message, and then send the job to DC Orchestrator Engine through the queue. If the job will be processed by DC Orchestrator Engine in synchronous way, the DC Orchestrator API will wait for the response from the DC Orchestrator Engine. Otherwise, the DC Orchestrator API will send response to the API caller first, and then send the job to DC Orchestrator Engine in asynchronous way.

Multiple DC Orchestrator API could run in parallel, and also can work in multi-worker mode.

Multiple DC Orchestrator API will be designed and run in stateless mode, persistent data will be accessed (read and write) from the DC Orchestrator Database through the DAL module.

Setup and encapsulate the API WSGI app

app.py:

Setup and encapsulate the API WSGI app, including integrate the keystonemiddleware app

apicfg.py:

API configuration loading and init

enforcer.py

Enforces policies on the version2 API's