mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
Build multinode test policies in the inputs shape so they reference their sources
This commit is contained in:
@@ -146,10 +146,12 @@ JSON
|
||||
fi
|
||||
|
||||
if [ -n "${src_id:-}" ]; then
|
||||
# 'inputs', not the legacy {trigger, sourceIds}: Policy has no sourceIds field, so the old
|
||||
# shape binds inputs=null and seeds a policy that watches nothing while still returning 200.
|
||||
pol_body=$(cat <<JSON
|
||||
{"name":"Compress incoming PDFs","enabled":true,
|
||||
"trigger":{"type":"schedule","options":{"schedule":{"type":"every","count":5,"unit":"MINUTES"}}},
|
||||
"sourceIds":["$src_id"],
|
||||
"inputs":[{"sourceId":"$src_id",
|
||||
"trigger":{"type":"schedule","options":{"schedule":{"type":"every","count":5,"unit":"MINUTES"}}}}],
|
||||
"steps":[{"operation":"/api/v1/misc/compress-pdf","parameters":{}}],
|
||||
"output":{"type":"s3","options":{"connectionId":$conn_id,"prefix":"processed/"}}}
|
||||
JSON
|
||||
|
||||
@@ -101,9 +101,11 @@ def _names_on_node(node, path, token):
|
||||
|
||||
|
||||
def _policy_body(name, source_ids=None, enabled=True):
|
||||
# Must be the 'inputs' shape. Policy has no sourceIds field, so a legacy
|
||||
# {sourceIds, trigger} body binds inputs=null and silently stores a policy referencing nothing.
|
||||
return json.dumps({
|
||||
"name": name, "enabled": enabled, "trigger": None,
|
||||
"sourceIds": source_ids or [],
|
||||
"name": name, "enabled": enabled,
|
||||
"inputs": [{"sourceId": sid, "trigger": None} for sid in (source_ids or [])],
|
||||
"steps": [{"operation": "/api/v1/misc/compress-pdf", "parameters": {}}],
|
||||
"output": {"type": "inline", "options": {}},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user