Skip to content

Commit 9d0e894

Browse files
authored
🐛Clusters-keeper: ensure json dicitionary is '-escaped (#7564)
1 parent 3a72585 commit 9d0e894

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

services/clusters-keeper/src/simcore_service_clusters_keeper/utils/clusters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import yaml
1010
from aws_library.ec2 import EC2InstanceBootSpecific, EC2InstanceData, EC2Tags
1111
from aws_library.ec2._models import CommandStr
12-
from common_library.json_serialization import json_dumps
1312
from common_library.serialization import model_dump_with_secrets
1413
from fastapi.encoders import jsonable_encoder
1514
from models_library.api_schemas_clusters_keeper.clusters import (
@@ -106,7 +105,7 @@ def _convert_to_env_dict(entries: dict[str, Any]) -> str:
106105
f"WORKERS_EC2_INSTANCES_SUBNET_ID={app_settings.CLUSTERS_KEEPER_WORKERS_EC2_INSTANCES.WORKERS_EC2_INSTANCES_SUBNET_ID}",
107106
f"WORKERS_EC2_INSTANCES_TIME_BEFORE_DRAINING={app_settings.CLUSTERS_KEEPER_WORKERS_EC2_INSTANCES.WORKERS_EC2_INSTANCES_TIME_BEFORE_DRAINING}",
108107
f"WORKERS_EC2_INSTANCES_TIME_BEFORE_TERMINATION={app_settings.CLUSTERS_KEEPER_WORKERS_EC2_INSTANCES.WORKERS_EC2_INSTANCES_TIME_BEFORE_TERMINATION}",
109-
f"AUTOSCALING_RABBITMQ={json_dumps(model_dump_with_secrets(app_settings.CLUSTERS_KEEPER_PRIMARY_EC2_INSTANCES.PRIMARY_EC2_INSTANCES_RABBIT, show_secrets=True)) if app_settings.CLUSTERS_KEEPER_PRIMARY_EC2_INSTANCES.PRIMARY_EC2_INSTANCES_RABBIT else 'null'}",
108+
f"AUTOSCALING_RABBITMQ={_convert_to_env_dict(model_dump_with_secrets(app_settings.CLUSTERS_KEEPER_PRIMARY_EC2_INSTANCES.PRIMARY_EC2_INSTANCES_RABBIT, show_secrets=True)) if app_settings.CLUSTERS_KEEPER_PRIMARY_EC2_INSTANCES.PRIMARY_EC2_INSTANCES_RABBIT else 'null'}",
110109
]
111110

112111

services/clusters-keeper/tests/unit/test_utils_clusters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_rabbitmq_settings_are_passed_with_pasword_clear(
247247
)
248248
assert isinstance(deploy_script, str)
249249

250-
match = re.search(r"AUTOSCALING_RABBITMQ=({.*?})", deploy_script)
250+
match = re.search(r"AUTOSCALING_RABBITMQ=\'({.*?})\'", deploy_script)
251251
assert match, "AUTOSCALING_RABBITMQ is not present in the deploy script!"
252252
autoscaling_rabbitmq = match.group(1)
253253
passed_settings = RabbitSettings.model_validate_json(autoscaling_rabbitmq)

0 commit comments

Comments
 (0)