Skip to content
Snippets Groups Projects

Sanitise all extra vars that are sent to LSO

Merged Karel van Klink requested to merge feature/update-geant-spelling into develop
5 files
+ 39
3
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -17,6 +17,7 @@ from orchestrator.workflow import Step, StepList, begin, callback_step, conditio
from pydantic import ConfigDict
from pydantic_forms.types import FormGenerator
from pydantic_forms.validators import Label, LongText, ReadOnlyField
from unidecode import unidecode
from gso import settings
@@ -42,6 +43,9 @@ def _send_request(parameters: dict, callback_route: str) -> None:
parameters: JSON body for the request, which will almost always at least consist of a subscription object, and a
boolean value to indicate a dry run.
callback_route: The callback route that should be used to resume the workflow.
Raises:
HTTPError: When receiving a non-successful status code from LSO.
"""
oss = settings.load_oss_params()
params = oss.PROVISIONING_PROXY
@@ -106,12 +110,13 @@ def _execute_playbook(
callback_route: The endpoint at which GSO expects a callback to continue the workflow executing this step.
inventory: An inventory of machines at which the playbook is targeted. Must be in YAML-compatible format.
extra_vars: Any extra variables that the playbook relies on. This can include a subscription object, a boolean
value indicating a dry run, a commit comment, etc.
value indicating a dry run, a commit comment, etc. All unicode character values are decoded to prevent
sending special characters to remote machines that don't support this.
"""
parameters = {
"playbook_name": playbook_name,
"inventory": inventory,
"extra_vars": extra_vars,
"extra_vars": json.loads(unidecode(json.dumps(extra_vars, ensure_ascii=False))),
}
_send_request(parameters, callback_route)
Loading