efe8a7251f
Each call to output_show is taking around 15 seconds for me, which
causes the entire inventory process to take 90 seconds or more.
Loading the entire stack with outputs resolved only takes around
20 seconds and keeps the total runtime of the dynamic inventory
much shorter overall because it only has to be done once.
The stack is lazy loaded at the first call to __getitem__ because it
seems that Ansible instantiates multiple copies of the class but
never actually looks anything up in some of them, so if we load the
stack in the constructor we just waste time retrieving it
unnecessarily.
This change has reduced the time it takes to run even simple ad-hoc
commands against a small 2 node inventory from 2.5-3 minutes to
45 seconds (which is still too long IMHO, but a step in the right
direction).
Closes-Bug: #1715428
Change-Id: I0fcde3f7641ccc26f045fcc8146ec4067e45330c
(cherry picked from commit
|
||
---|---|---|
.. | ||
tests | ||
__init__.py | ||
inventory.py | ||
utils.py |