@@ -76,10 +76,16 @@ func (lv *LeafVariants) canDelete() bool {
7676 return false
7777 }
7878
79+ // check if highest is explicit delete
80+ highest := lv .GetHighestPrecedence (false , false )
81+ if highest != nil && highest .IsExplicitDelete && lv .GetRunning () != nil {
82+ return true
83+ }
84+
7985 // go through all variants
8086 for _ , l := range lv .les {
8187 // if the LeafVariant is not owned by running or default
82- if l .Update .Owner () != RunningIntentName && l .Update .Owner () != DefaultsIntentName {
88+ if l .Update .Owner () != RunningIntentName && l .Update .Owner () != DefaultsIntentName && ! l . IsExplicitDelete {
8389 // then we need to check that it remains, so not Delete Flag set or DeleteOnylIntended Flags set [which results in not doing a delete towards the device]
8490 if l .GetDeleteOnlyIntendedFlag () || ! l .GetDeleteFlag () {
8591 // then this entry should not be deleted
@@ -101,11 +107,17 @@ func (lv *LeafVariants) shouldDelete() bool {
101107 return false
102108 }
103109
110+ // check if highest is explicit delete
111+ highest := lv .GetHighestPrecedence (false , false )
112+ if highest != nil && highest .IsExplicitDelete && lv .GetRunning () != nil {
113+ return true
114+ }
115+
104116 foundOtherThenRunningAndDefault := false
105117 // go through all variants
106118 for _ , l := range lv .les {
107119 // if an entry exists that is not owned by running or default,
108- if l .Update .Owner () == RunningIntentName || l .Update .Owner () == DefaultsIntentName {
120+ if l .Update .Owner () == RunningIntentName || l .Update .Owner () == DefaultsIntentName || l . IsExplicitDelete {
109121 continue
110122 }
111123 foundOtherThenRunningAndDefault = true
0 commit comments