mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07: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:
parent
28227546fa
commit
c23b11d212
4 changed files with 38 additions and 11 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue