Replace bare Dataloader() with pre-loaded play._loader #917
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
馃Ч
The
play._loader
already exists. It is pre-loaded withplay._loader._vault.secrets
,play._loader.FILE_CACHE
, etc. There's little point in creating a freshDataloader()
and having to process or load it up.The life of a
loader
No need to read this.
The
ansible-playbook
cli commandPlaybookCLI()
runs its base class's_play_prereqs()
which initializes a newloader
and processes it, runningsetup_vault_secrets()
etc.The
PlaybookCLI
then passes this pre-loadedloader
instance to thePlaybookExecutor
which forwards on theloader
viaPlaybook.load()
which uses theloader
to initialize a newPlaybook()
.The
Playbook()
uses theloader
to initialize our givenPlay()
. Finally, Trellis can access theplay._loader
via thev2_playbook_on_play_start
callback method.This
loader
is all loaded up withvault_secrets
and_FILE_CACHE
, in contrast to a bare newDataloader()
we've been using and would otherwise need to load up manually. The pre-loaded_loader._vault.secrets
obviates procedures such as this.