Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bare Dataloader() with pre-loaded play._loader #917

Merged
merged 1 commit into from Nov 12, 2017
Merged

Conversation

fullyint
Copy link
Contributor

馃Ч

The play._loader already exists. It is pre-loaded with play._loader._vault.secrets, play._loader.FILE_CACHE, etc. There's little point in creating a fresh Dataloader() and having to process or load it up.

The life of a loader

No need to read this.

The ansible-playbook cli command PlaybookCLI() runs its base class's _play_prereqs() which initializes a new loader and processes it, running setup_vault_secrets() etc.

The PlaybookCLI then passes this pre-loaded loader instance to the PlaybookExecutor which forwards on the loader via Playbook.load() which uses the loader to initialize a new Playbook().

The Playbook() uses the loader to initialize our given Play(). Finally, Trellis can access the play._loader via the v2_playbook_on_play_start callback method.

This loader is all loaded up with vault_secrets and _FILE_CACHE, in contrast to a bare new Dataloader() we've been using and would otherwise need to load up manually. The pre-loaded _loader._vault.secrets obviates procedures such as this.

The play._loader already exists. It is pre-loaded with
play._loader._vault.secrets, play._loader.FILE_CACHE, etc.
There's little point in creating a fresh Dataloader()
and having to process or load it up.
@fullyint fullyint merged commit 2d53e81 into master Nov 12, 2017
@fullyint fullyint deleted the play-loader branch November 12, 2017 18:59
primozcigler added a commit to primozcigler/trellis that referenced this pull request Nov 19, 2017
* tag '1.0.0-rc.2':
  1.0.0-rc.2
  Update to WP-CLI 1.4.1.
  Disallow duplicate site keys within a host's wordpress_sites (roots#910)
  Replace bare Dataloader() with pre-loaded play._loader (roots#917)
  Remove outdated to_unicode import from plugin utils (roots#916)
  Fix raw_vars functionality for Ansible 2.4.1 (roots#915)
  Enable ioapic
  Update vagrant_box_version to current release
primozcigler added a commit to proteusthemes/pt-ops that referenced this pull request Jan 5, 2018
* trellis/master: (292 commits)
  Bump Ansible version_tested_max to 2.4.2.0 (roots#932)
  Add MariaDB 10.2 PPA
  Remove cron_file if WP system cron disabled (roots#927)
  Add Code of Conduct [ci skip]
  Expose the deploy_helper keep_releases option (roots#922)
  Close roots#580 - Switch from .dev to .test
  Update acme-tiny commit hash
  Enable select deploy configs to optionally vary by site (roots#919)
  1.0.0-rc.2
  Update to WP-CLI 1.4.1.
  Disallow duplicate site keys within a host's wordpress_sites (roots#910)
  Replace bare Dataloader() with pre-loaded play._loader (roots#917)
  Remove outdated to_unicode import from plugin utils (roots#916)
  Fix raw_vars functionality for Ansible 2.4.1 (roots#915)
  Enable ioapic
  Update vagrant_box_version to current release
  Dynamically increase ansible_group_priority for selected env (roots#909)
  Bump Ansible version_tested_max to 2.4.1.0 (roots#911)
  Clarify DB task name.
  Update wp-cli to 1.4.0.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants