Files
distcloud/distributedcloud/dcorch/api
Enzo Candotti e196b6f6a3 Fix error syncing certificates thru dcorch-proxy
When installing CA certificates using the dcorch proxy, an error
occurred because the certificate data was being handled as bytes
instead of a string. This caused a serialization error when
processing the request.

Now the certificate payload is always converted to a UTF-8 string
before sending it to the next step, preventing this problem.
Additionally, when parsing multipart form data in
_decode_certificate_payload, the fields from each part are also
decoded from UTF-8 to string. This guarantees all data handled
downstream is in string format and compatible with JSON serialization.

Test Plan:
- PASS: Install a CA certificate via dcorch-proxy using
  "--os-region-name SystemController". Verify that the orchjob is
  created correctly and that the certificate is installed immediately
  in the subcloud.
- PASS: Uninstall a CA certificate via dcorch-proxy. Verify that the
  certificate is uninstalled from the subcloud immediately.
- PASS: Install a CA certificate without dcorch proxy and wait until
  the audit job detects it. Verify the certificate is installed in
  the subcloud.
- PASS: Unmanage the subcloud and install a certificate with the same
  CN on both the system controller and the subcloud. Verify that
  the certificate is in sync after managing the subcloud again.

Closes-bug: 2113779

Change-Id: If4b1ea17434bd4a999ed7af06ffd0a2364f36a97
Signed-off-by: Enzo Candotti <Enzo.Candotti@windriver.com>
2025-06-09 19:19:20 -03:00
..
2024-06-28 13:42:16 +00:00
2024-06-28 13:42:16 +00: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