mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
[Inventory] Cache the result of enumerating groups and host names
for `VariableManager._get_magic_variables()`. This saves a lot of time re-iterating the nearly always constant global list of groups and their members. Generate once and cache, and invalidate cache in case `add_host:` or `group_by:` are used.
This commit is contained in:
committed by
James Cammarata
parent
28227546fa
commit
c23b11d212
@@ -237,6 +237,7 @@ class TestStrategyBase(unittest.TestCase):
|
||||
mock_inventory.get_host.side_effect = _get_host
|
||||
mock_inventory.get_group.side_effect = _get_group
|
||||
mock_inventory.clear_pattern_cache.return_value = None
|
||||
mock_inventory.clear_group_dict_cache.return_value = None
|
||||
mock_inventory.get_host_vars.return_value = {}
|
||||
|
||||
mock_var_mgr = MagicMock()
|
||||
|
||||
Reference in New Issue
Block a user