Inventory plugin error

Hello!

I wanted to use the Scaleway inventory plugin to launch my playbook but I encounter an error with Ansible 2.6.

~ $ ansible-inventory -vvv --list -i scaleway_inventory.yml
ansible-inventory 2.6.0.dev0
config file = /Users/abarbare/.ansible.cfg
configured module search path = [u’/Users/abarbare/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible-inventory
python version = 2.7.15 (default, May 1 2018, 16:44:08) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)]
Using /Users/abarbare/.ansible.cfg as config file
ERROR! Unexpected Exception, this is probably a bug: ‘InventoryModule’ object has no attribute ‘_load_name’
the full traceback was:

Traceback (most recent call last):
File “/usr/local/bin/ansible-inventory”, line 118, in
exit_code = cli.run()
File “/usr/local/lib/python2.7/site-packages/ansible/cli/inventory.py”, line 136, in run
self.loader, self.inventory, self.vm = self._play_prereqs(self.options)
File “/usr/local/lib/python2.7/site-packages/ansible/cli/init.py”, line 806, in _play_prereqs
inventory = InventoryManager(loader=loader, sources=options.inventory)
File “/usr/local/lib/python2.7/site-packages/ansible/inventory/manager.py”, line 145, in init
self.parse_sources(cache=True)
File “/usr/local/lib/python2.7/site-packages/ansible/inventory/manager.py”, line 197, in parse_sources
self._setup_inventory_plugins()
File “/usr/local/lib/python2.7/site-packages/ansible/inventory/manager.py”, line 184, in _setup_inventory_plugins
plugin = inventory_loader.get(name)
File “/usr/local/lib/python2.7/site-packages/ansible/plugins/loader.py”, line 397, in get
obj = obj(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/ansible/plugins/inventory/scaleway.py”, line 85, in init
self.token = self.get_option(“oauth_token”)
File “/usr/local/lib/python2.7/site-packages/ansible/plugins/init.py”, line 58, in get_option
option_value = C.config.get_config_value(option, plugin_type=get_plugin_class(self), plugin_name=self._load_name, variables=hostvars)
AttributeError: ‘InventoryModule’ object has no attribute ‘_load_name’

The init.py file has been modified on November https://github.com/ansible/ansible/commit/23f8833e8745f01b490a6e12dd0f3e946d89654f
Do you have some clue on the source of the issue?

Thanks,

I don’t have Scaleway to test with but I think if you remove this line: https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/inventory/scaleway.py#L85 and add it here instead https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/inventory/scaleway.py#L149 it will work. The options are set in _read_config_data.

A PR fixes this problem: https://github.com/ansible/ansible/pull/41259