@@ -18,7 +18,7 @@ type Node struct {
18
18
HardwareF * Hardware `json:"hardware" yaml:"hardware" structs:"hardware" mapstructure:"hardware"`
19
19
NetworkF * Network `json:"network" yaml:"network" structs:"network" mapstructure:"network"`
20
20
InjectionsF []* Injection `json:"injections" yaml:"injections" structs:"injections" mapstructure:"injections"`
21
-
21
+ DeletionsF [] * Deletion `json:"deletions" yaml:"deletions" structs:"deletions" mapstructure:"deletions"`
22
22
}
23
23
24
24
func (this Node ) Annotations () map [string ]interface {} {
@@ -55,6 +55,16 @@ func (this Node) Injections() []ifaces.NodeInjection {
55
55
return injects
56
56
}
57
57
58
+ func (this Node ) Deletions () []ifaces.NodeDeletion {
59
+ deletions := make ([]ifaces.NodeDeletion , len (this .DeletionsF ))
60
+
61
+ for i , j := range this .DeletionsF {
62
+ deletions [i ] = j
63
+ }
64
+
65
+ return deletions
66
+ }
67
+
58
68
func (this Node ) Delay () ifaces.NodeDelay {
59
69
return new (Delay )
60
70
}
@@ -85,6 +95,16 @@ func (this *Node) SetInjections(injections []ifaces.NodeInjection) {
85
95
this .InjectionsF = injects
86
96
}
87
97
98
+ func (this * Node ) SetDeletions (deletions []ifaces.NodeDeletion ) {
99
+ deletionList := make ([]* Deletion , len (deletions ))
100
+
101
+ for i , j := range deletions {
102
+ deletionList [i ] = j .(* Deletion )
103
+ }
104
+
105
+ this .DeletionsF = deletionList
106
+ }
107
+
88
108
func (this * Node ) SetType (t string ) {
89
109
this .TypeF = t
90
110
}
@@ -182,6 +202,13 @@ func (this *Node) AddInject(src, dst, perms, desc string) {
182
202
})
183
203
}
184
204
205
+ func (this * Node ) AddDeletion (path , desc string ) {
206
+ this .DeletionsF = append (this .DeletionsF , & Deletion {
207
+ PathF : path ,
208
+ DescriptionF : desc ,
209
+ })
210
+ }
211
+
185
212
func (Node ) SetAdvanced (map [string ]string ) {}
186
213
func (Node ) AddAdvanced (string , string ) {}
187
214
func (Node ) AddOverride (string , string ) {}
@@ -211,7 +238,6 @@ type General struct {
211
238
VMTypeF string `json:"vm_type" yaml:"vm_type" structs:"vm_type" mapstructure:"vm_type"`
212
239
SnapshotF * bool `json:"snapshot" yaml:"snapshot" structs:"snapshot" mapstructure:"snapshot"`
213
240
DoNotBootF * bool `json:"do_not_boot" yaml:"do_not_boot" structs:"do_not_boot" mapstructure:"do_not_boot"`
214
-
215
241
}
216
242
217
243
func (this General ) Hostname () string {
@@ -229,7 +255,7 @@ func (this General) VMType() string {
229
255
func (this General ) Snapshot () * bool {
230
256
return this .SnapshotF
231
257
}
232
- func (this * General ) SetSnapshot (b bool ) {
258
+ func (this * General ) SetSnapshot (b bool ) {
233
259
this .SnapshotF = & b
234
260
}
235
261
@@ -353,6 +379,19 @@ func (this Injection) Permissions() string {
353
379
return this .PermissionsF
354
380
}
355
381
382
+ type Deletion struct {
383
+ PathF string `json:"path" yaml:"path" structs:"path" mapstructure:"path"`
384
+ DescriptionF string `json:"description" yaml:"description" structs:"description" mapstructure:"description"`
385
+ }
386
+
387
+ func (this Deletion ) Path () string {
388
+ return this .PathF
389
+ }
390
+
391
+ func (this Deletion ) Description () string {
392
+ return this .DescriptionF
393
+ }
394
+
356
395
type Delay struct {}
357
396
358
397
func (this Delay ) Timer () time.Duration {
@@ -423,6 +462,16 @@ func (this Node) FileInjects(baseDir string) string {
423
462
return strings .Join (injects , " " )
424
463
}
425
464
465
+ func (this Node ) FileDeletions () string {
466
+ deletions := make ([]string , len (this .DeletionsF ))
467
+
468
+ for i , deletion := range this .DeletionsF {
469
+ deletions [i ] = fmt .Sprintf (`"%s"` , deletion .PathF )
470
+ }
471
+
472
+ return strings .Join (deletions , "," )
473
+ }
474
+
426
475
func (this Node ) RouterName () string {
427
476
if ! strings .EqualFold (this .TypeF , "router" ) {
428
477
return this .GeneralF .HostnameF
0 commit comments