Skip to content

Commit 989740f

Browse files
committed
fix(be): do not try to delete inventory dir
1 parent 0bdd28e commit 989740f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

db/Inventory.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package db
33
type InventoryType string
44

55
const (
6-
//InventoryNone InventoryType = "none"
76
InventoryStatic InventoryType = "static"
87
InventoryStaticYaml InventoryType = "static-yaml"
98
// InventoryFile means that it is path to the Ansible inventory file
@@ -12,6 +11,10 @@ const (
1211
InventoryTofuWorkspace InventoryType = "tofu-workspace"
1312
)
1413

14+
func (i InventoryType) IsStatic() bool {
15+
return i == InventoryStatic || i == InventoryStaticYaml
16+
}
17+
1518
// Inventory is the model of an ansible inventory file
1619
type Inventory struct {
1720
ID int `db:"id" json:"id" backup:"-"`

services/tasks/LocalJob_inventory.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ func (t *LocalJob) installStaticInventory() error {
9191
}
9292

9393
func (t *LocalJob) destroyInventoryFile() {
94+
if !t.Inventory.Type.IsStatic() {
95+
return
96+
}
97+
9498
fullPath := t.tmpInventoryFullPath()
9599
if err := os.Remove(fullPath); err != nil {
96100
log.Error(err)

0 commit comments

Comments
 (0)