File tree 2 files changed +8
-1
lines changed 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package db
3
3
type InventoryType string
4
4
5
5
const (
6
- //InventoryNone InventoryType = "none"
7
6
InventoryStatic InventoryType = "static"
8
7
InventoryStaticYaml InventoryType = "static-yaml"
9
8
// InventoryFile means that it is path to the Ansible inventory file
@@ -12,6 +11,10 @@ const (
12
11
InventoryTofuWorkspace InventoryType = "tofu-workspace"
13
12
)
14
13
14
+ func (i InventoryType ) IsStatic () bool {
15
+ return i == InventoryStatic || i == InventoryStaticYaml
16
+ }
17
+
15
18
// Inventory is the model of an ansible inventory file
16
19
type Inventory struct {
17
20
ID int `db:"id" json:"id" backup:"-"`
Original file line number Diff line number Diff line change @@ -91,6 +91,10 @@ func (t *LocalJob) installStaticInventory() error {
91
91
}
92
92
93
93
func (t * LocalJob ) destroyInventoryFile () {
94
+ if ! t .Inventory .Type .IsStatic () {
95
+ return
96
+ }
97
+
94
98
fullPath := t .tmpInventoryFullPath ()
95
99
if err := os .Remove (fullPath ); err != nil {
96
100
log .Error (err )
You can’t perform that action at this time.
0 commit comments