voxpupuli / puppet-elasticsearch

Elasticsearch Puppet module
Apache License 2.0
403 stars 478 forks source link

Error: Could not find a suitable provider for elasticsearch_role/elasticsearch_user_roles #1002

Open joernott opened 5 years ago

joernott commented 5 years ago

Bug description

When installing elasticsearch on an all-in-one development box together with many applications (and thus many modules), the following error messages pop up regularly and lead to a failed puppet run:

This is due to the way, how these users are created, which triggers a bug in puppet when collecting resources.

We worked around this issue by using file resources for "${elasticsearch_home}/config/${instance}/x-pack/users", "${elasticsearch_home}/config/${instance}/x-pack/users_roles" and "${elasticsearch_home}/config/${instance}/x-pack/roles.yml" instead of using the defined types elasticsearch::role and elasticsearch::user for the file based users and defined our own defined types which create roles and users via curl calls to the API.

Attached examples are stripped down/simplified. auth_snippet.pp.txt role.pp.txt roles.yml.epp.txt user.pp.txt users.epp.txt users_roles.epp.txt

joernott commented 5 years ago

Despite not using elasticsearch::user and elasticsearch::role any more, Puppet still shows an error when building a machine from scratch: 27/11/2018 09:30:03 default: Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Virtual Query, Could not autoload puppet/type/elasticsearch_user: Could not autoload puppet/provider/elasticsearch_user/elasticsearch_users: no such file to load -- puppet/provider/elastic_user_command at /etc/puppetlabs/code/environments/vbox/modules/elasticsearch/manifests/init.pp:554:3 on node box-krn0-vbx-v01.sf-bk.de The next run, I get 27/11/2018 09:30:22 default: Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Virtual Query, Could not autoload puppet/type/elasticsearch_user_file: Could not autoload puppet/provider/elasticsearch_user_file/oss_xpack: no such file to load -- puppet/provider/elastic_parsedfile at /etc/puppetlabs/code/environments/vbox/modules/elasticsearch/manifests/init.pp:555:6 on node box-krn0-vbx-v01.sf-bk.de and the third run then succeeds.

shazi7804 commented 5 years ago

Could not autoload +1

nod0n commented 5 years ago

I had a similar Issue: Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Virtual Query, Could not autoload puppet/type/elasticsearch_user: Could not autoload puppet/provider/elasticsearch_user/esusers: no such file to load -- puppet/provider/elastic_user_command at /etc/puppetlabs/code/environments/production/modules/elasticsearch/manifests/init.pp:544:3 on node mynode wrote about it in the puppet slack: https://puppetcommunity.slack.com/archives/C0W298S9G/p1549546357003900 I used the sugseted work around: I replaced require with require_relative in the file elasticsearch/lib/puppet/provider/elasticsearch_user/elasticsearch_users.rb line 1. This fixed my Problem! I suggest, read the thread from slack I posted above and you see the complete discussion.

bovy89 commented 5 years ago

+1

mouglou commented 4 years ago

FYI, we just facing this exact same problem and we found why. Maybe its not gonna solve the issue for you, but it worked for us.

The problem was coming from the fact that in the "modules" puppet directory, we had the new version of the module in the "elasticsearch" folder, and the older version in the "elasticsearch.ori" folder. And in 99% of puppet run, we get the error because the loaded provider was coming from "elasticsearch.ori".

Since I removed this folder, to get ONLY one elasticsearch module folder, no more error. Every puppet run are ok.

Maybe it can help. Maybe not !