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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Inventory Plugin Loading #31605

Merged
merged 1 commit into from
Oct 12, 2017
Merged

Fix Inventory Plugin Loading #31605

merged 1 commit into from
Oct 12, 2017

Conversation

cognifloyd
Copy link
Contributor

SUMMARY

This change makes the PluginLoader use DEFAULT_INVENTORY_PLUGIN_PATH setting.
Inventory Plugins were only being loaded the 'inventory_plugins' folder of the current directory,
as well as the ansible-provided inventory plugins (e.g. /path/to/site-packages/ansible/plugins/inventory).

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

inventory manager

ANSIBLE VERSION
ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ubuntu/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
ADDITIONAL INFORMATION

My inventory plugin was only loading if I happened to be in the parent directory of a folder called 'inventory_plugins' that contained my plugin. I tried various configurations in ansible.cfg, but the
setting didn't seem to be used. To debug, I ended up adding this just after the InventoryManager loads the PluginLoader:

display.vvvv(str(inventory_loader._get_paths()))

That line in the output said (where cwd=/home/ubuntu):

['/home/ubuntu/inventory_plugins', '/usr/local/lib/python2.7/dist-packages/ansible/plugins/inventory']

Applying this change, the output matches what I set in my ansible.cfg. :)

This change makes the PluginLoader use DEFAULT_INVENTORY_PLUGIN_PATH setting.
Inventory Plugins were only being loaded the 'inventory_plugins' folder of the current directory,
as well as the ansible-provided inventory plugins (e.g. `/path/to/site-packages/ansible/plugins/inventory`).
@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request inventory Inventory category needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 11, 2017
@cognifloyd
Copy link
Contributor Author

I hope this makes it into 2.4.1 BTW

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 11, 2017
@bcoca bcoca added this to Nominated in 2.4.x Blocker List Oct 11, 2017
@abadger abadger moved this from Nominated to To be cherrypicked (rc only) in 2.4.x Blocker List Oct 11, 2017
@abadger abadger moved this from To be cherrypicked (rc only) to In Progress in 2.4.x Blocker List Oct 11, 2017
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Oct 11, 2017
@abadger
Copy link
Contributor

abadger commented Oct 12, 2017

Errors are unstable tests due to networked repositories (outside of our control). Merging and cherry-picking for 2.4.1rc1.

@abadger abadger merged commit 0371d0d into ansible:devel Oct 12, 2017
abadger pushed a commit that referenced this pull request Oct 12, 2017
This change makes the PluginLoader use DEFAULT_INVENTORY_PLUGIN_PATH setting.
Inventory Plugins were only being loaded the 'inventory_plugins' folder of the current directory,
as well as the ansible-provided inventory plugins (e.g. `/path/to/site-packages/ansible/plugins/inventory`).
(cherry picked from commit 0371d0d)
@abadger abadger moved this from In Progress to Done in 2.4.x Blocker List Oct 12, 2017
BondAnthony pushed a commit to BondAnthony/ansible that referenced this pull request Oct 14, 2017
This change makes the PluginLoader use DEFAULT_INVENTORY_PLUGIN_PATH setting.
Inventory Plugins were only being loaded the 'inventory_plugins' folder of the current directory,
as well as the ansible-provided inventory plugins (e.g. `/path/to/site-packages/ansible/plugins/inventory`).
mtb-xt pushed a commit to mtb-xt/ansible that referenced this pull request Oct 15, 2017
This change makes the PluginLoader use DEFAULT_INVENTORY_PLUGIN_PATH setting.
Inventory Plugins were only being loaded the 'inventory_plugins' folder of the current directory,
as well as the ansible-provided inventory plugins (e.g. `/path/to/site-packages/ansible/plugins/inventory`).
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. inventory Inventory category needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
2.4.x Blocker List
Done in 2.4.1
Development

Successfully merging this pull request may close these issues.

None yet

4 participants