Skip to content

Commit

Permalink
Don't insert previously negated items Applications.append_if_new()
Browse files Browse the repository at this point in the history
We add a check in `Applications.append_if_new()` to only insert
non-negated items if they aren't already on our internal negation list.

This fixes the issue where it wasn't possible to preemptively remove an
entry from the applications list in a multi-dimensional hierarchy, e.g.
in a [Commodore] global defaults repository where we may want to exclude
applications for a certain Kubernetes distribution regardless of the
cloud on which a cluster with that distribution is running.

[Commodore]: https://syn.tools/commodore
  • Loading branch information
simu committed Jul 26, 2022
1 parent 80d6d15 commit 8c7e8a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reclass/datatypes/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def append_if_new(self, item):
self._items.remove(item)
except ValueError:
pass
else:
elif item not in self._negations:
# Only insert non-negated items if they're not in our negations list
# already.
super(Applications, self)._append_if_new(item)

def merge_unique(self, iterable):
Expand Down

0 comments on commit 8c7e8a2

Please sign in to comment.