Skip to content

Commit 88d81b1

Browse files
committed
fix: auto-create external deployment for manual-only collectors
When saving collector credentials via POST /api/config, auto-insert an "external" deployment record for services that have no Docker image (manual-only). Without this, _run_collection() never instantiates collectors for Salad, Grass, Bytelixir, or any future manual-only service because make_collectors() requires a matching deployment row. Also adds auth_cookie to the secret_args mask list.
1 parent b4d6615 commit 88d81b1

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

app/main.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,7 @@ async def api_collectors_meta(request: Request) -> list[dict[str, Any]]:
12711271
"access_token",
12721272
"api_key",
12731273
"session_cookie",
1274+
"auth_cookie",
12741275
"oauth_token",
12751276
"brd_sess_id",
12761277
}
@@ -1318,6 +1319,30 @@ class ConfigUpdate(BaseModel):
13181319
async def api_set_config(request: Request, body: ConfigUpdate) -> dict[str, str]:
13191320
_require_owner(request)
13201321
await database.set_config_bulk(body.data)
1322+
1323+
# Auto-create "external" deployment records for manual-only services
1324+
# whose collector credentials were just saved. Without a deployment
1325+
# row, _run_collection() will never instantiate the collector.
1326+
from app.collectors import _COLLECTOR_ARGS
1327+
1328+
for slug, arg_keys in _COLLECTOR_ARGS.items():
1329+
required_keys = [f"{slug}_{a.lstrip('?')}" for a in arg_keys if not a.startswith("?")]
1330+
if not required_keys:
1331+
continue
1332+
if not all(body.data.get(k) for k in required_keys):
1333+
continue
1334+
svc = catalog.get_service(slug)
1335+
if not svc:
1336+
continue
1337+
docker_conf = svc.get("docker", {})
1338+
has_image = bool(docker_conf and docker_conf.get("image"))
1339+
if has_image:
1340+
continue # Docker services get deployed normally
1341+
existing = await database.get_deployment(slug)
1342+
if not existing:
1343+
await database.save_deployment(slug=slug, container_id="", status="external")
1344+
logger.info("Auto-created external deployment for %s", slug)
1345+
13211346
return {"status": "saved"}
13221347

13231348

0 commit comments

Comments
 (0)