Support alternative variable overrides

Bug #1665050 reported by Jim Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
craton
New
Undecided
Unassigned

Bug Description

Craton's variable override model is based on ChainMap (https://docs.python.org/3/library/collections.html#collections.ChainMap), which follows an override model for lookups that is identical to Python's own scoping model.

However, this is not the only choice. Instead the override can be a merge: eg for a list/set, the result is effectively a union of parent and child lists/sets. For two dicts, parent and child, this could be the same as doing parent.update(child).

There are some nuances: what if the collections are not the same type? For the list case, do the parent's items come first? Are duplicates removed?

One possibility is to make this configurable for a given namespace like ansible/, and follow any desired conventions for that namespace.

Any such work should probably subclass ChainMap, but it should otherwise ducktype like a ChainMap.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.