diff --git a/services/tasks/TaskRunner.go b/services/tasks/TaskRunner.go index 5f0b734f5..fa5385678 100644 --- a/services/tasks/TaskRunner.go +++ b/services/tasks/TaskRunner.go @@ -249,7 +249,7 @@ func (t *TaskRunner) populateDetails() error { } // get inventory - if t.Task.InventoryID!=nil{ + if t.Task.InventoryID != nil { t.Inventory, err = t.pool.store.GetInventory(t.Template.ProjectID, *t.Task.InventoryID) if err != nil { if t.Template.InventoryID != nil { @@ -259,6 +259,13 @@ func (t *TaskRunner) populateDetails() error { } } } + } else { + if t.Template.InventoryID != nil { + t.Inventory, err = t.pool.store.GetInventory(t.Template.ProjectID, *t.Template.InventoryID) + if err != nil { + return t.prepareError(err, "Template Inventory not found!") + } + } } // get repository