Portainer fix (#486)
* fix: update customer code formatting in template variables * feat: add customer_code field to ProvisionWorkerRequest and update provisioning logic
taylor_socfortress committed
Aug 6, 2025 at 14:19 UTC
238af2a046b9e49542dc0076791edbd49a2ced33
3 files changed
+8
-1
backend/app/connectors/portainer/services/stack.py
+2
-1
@@ -97,9 +97,10 @@ async def _prepare_template_variables(request: ProvisionNewCustomer, node_count:
97
"""
98
formatted_customer_name = request.customer_name.replace(" ", "_")
99
wazuh_manager_version = await get_wazuh_manager_version()
100
+ formatted_customer_code = request.customer_code.replace(" ", "_")
101
102
return {
102
- "{{ wazuh_worker_customer_code }}": formatted_customer_name,
103
+ "{{ wazuh_worker_customer_code }}": formatted_customer_code,
104
"{{ wazuh_manager_version }}": wazuh_manager_version,
105
"REPLACE_LOG": request.wazuh_logs_port,
106
"REPLACE_REGISTRATION": request.wazuh_registration_port,
backend/app/customer_provisioning/schema/wazuh_worker.py
+5
@@ -11,6 +11,11 @@ class ProvisionWorkerRequest(BaseModel):
11
example="SOCFortress",
12
description="The name of the customer",
13
)
14
+ customer_code: str = Field(
15
+ ...,
16
+ example="socfortress",
17
+ description="The code of the customer",
18
+ )
19
wazuh_auth_password: str = Field(
20
...,
21
example="password",
backend/app/customer_provisioning/services/provision.py
+1
@@ -148,6 +148,7 @@ async def provision_wazuh_customer(
148
provision_worker = await provision_wazuh_worker(
149
ProvisionWorkerRequest(
150
customer_name=request.customer_name,
151
+ customer_code=request.customer_code,
152
wazuh_auth_password=request.wazuh_auth_password,
153
wazuh_registration_port=request.wazuh_registration_port,
154
wazuh_logs_port=request.wazuh_logs_port,