fix: seed now merges attributes instead of overwriting on upsert, add enrollment attrs to seed
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

This commit is contained in:
2026-07-08 12:02:46 +02:00
parent f07668c1c3
commit 4724d6f297
2 changed files with 8 additions and 3 deletions

View File

@@ -123,8 +123,10 @@ func IngestInventorySeed(ctx context.Context, tx pgx.Tx, data map[string]any) (*
_, err = tx.Exec(ctx,
`INSERT INTO entities (id, slug, type, name, state, attributes, version, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, 1, now(), now())
ON CONFLICT (slug) DO UPDATE SET type = $3, name = $4, state = $5,
attributes = $6, updated_at = now()`,
ON CONFLICT (slug) DO UPDATE SET
type = EXCLUDED.type, name = EXCLUDED.name,
attributes = entities.attributes || EXCLUDED.attributes,
updated_at = now()`,
entityID, slug, typeName, name, nullableStr(state), string(attrsBytes))
if err != nil {
return nil, fmt.Errorf("entity %s: %w", slug, err)

View File

@@ -96,7 +96,10 @@ entities:
lan_ip: 192.168.178.182
mesh: {netbird: {fqdn: mac-mini-234-17.netbird.selfhosted}}
age_pubkey: age169104ee1a9e1577d493820830560197f0adf56bf8f1c369d57c152c03f9437ae
note: only macOS in fleet; future Oikos OS Docker host
note: only macOS in fleet; Oikos Docker host. Enrolled 2026-07-08.
enrolled_at: "2026-07-08T09:49:03Z"
mesh_ip: 192.168.178.182
hostname: mac-mini
- slug: "ws:republic-laptop"
type: workstation
name: republic-laptop