Skip to content

Commit b9a931a

Browse files
committed
fix(backup): integration inventory id
1 parent 569109b commit b9a931a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

services/project/backup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ func (b *BackupDB) format() (*BackupFormat, error) {
363363
Template: *tplName,
364364
AuthSecret: keyName,
365365
}
366+
367+
if o.TaskParams != nil && o.TaskParams.InventoryID != nil {
368+
integrations[i].TaskParams.InventoryName, _ = findNameByID[db.Inventory](*o.TaskParams.InventoryID, b.inventories)
369+
}
366370
}
367371

368372
var integrationAliases []string

services/project/restore.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,11 @@ func (e BackupIntegration) Restore(store db.Store, b *BackupDB) error {
345345
integration.ProjectID = b.meta.ID
346346
integration.AuthSecretID = authSecretID
347347
integration.TemplateID = tpl.ID
348+
348349
if integration.TaskParams != nil {
349-
params := e.TaskParams
350-
if params != nil {
351-
integration.TaskParams.InventoryID = &params.ID
350+
inv := findEntityByName[db.Inventory](e.TaskParams.InventoryName, b.inventories)
351+
if inv != nil {
352+
integration.TaskParams.InventoryID = &inv.ID
352353
}
353354
}
354355

0 commit comments

Comments
 (0)