Add instance ID to JSON output

This commit is contained in:
2025-12-06 21:28:17 +01:00
parent 0217f7cc4e
commit 02193bd309
3 changed files with 2 additions and 1 deletions

View File

@@ -271,6 +271,7 @@ func (db *sqliteDB) rowToInstance(row *instanceRow) (*instance.Instance, error)
// Build complete instance JSON with all fields // Build complete instance JSON with all fields
instanceJSON, err := json.Marshal(map[string]any{ instanceJSON, err := json.Marshal(map[string]any{
"id": row.ID,
"name": row.Name, "name": row.Name,
"created": row.CreatedAt, "created": row.CreatedAt,
"status": row.Status, "status": row.Status,

View File

@@ -176,6 +176,7 @@ func (im *instanceManager) loadInstance(persistedInst *instance.Instance) error
inst := instance.New(name, im.globalConfig, options, statusCallback) inst := instance.New(name, im.globalConfig, options, statusCallback)
// Restore persisted fields that NewInstance doesn't set // Restore persisted fields that NewInstance doesn't set
inst.ID = persistedInst.ID
inst.Created = persistedInst.Created inst.Created = persistedInst.Created
inst.SetStatus(persistedInst.GetStatus()) inst.SetStatus(persistedInst.GetStatus())

View File

@@ -37,7 +37,6 @@ func (im *instanceManager) ListInstances() ([]*instance.Instance, error) {
if node := im.getNodeForInstance(inst); node != nil { if node := im.getNodeForInstance(inst); node != nil {
remoteInst, err := im.remote.getInstance(ctx, node, inst.Name) remoteInst, err := im.remote.getInstance(ctx, node, inst.Name)
if err != nil { if err != nil {
// Log error but continue with stale data
// Don't fail the entire list operation due to one remote failure // Don't fail the entire list operation due to one remote failure
continue continue
} }