Puppet 茶包解題 resource type 不見了「Error while evaluating a Virtual Query, Could not autoload type no such file to load」

2018-09-05 Puppet

最近升級 Elasticsearch 的版本到 6.3.0 後開始偶爾會出現 Error 500 的陌生訊息:

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/shield: no such file to load — puppet/provider/elastic_parsedfile at /etc/puppetlabs/code/modules/elasticsearch/manifests/init.pp:545:6 on node

 

一開始去 elastic/puppet-elasticsearch 這邊找到類似的問題「Regression? Could not autoload puppet/provider/elasticsearch_plugin/elasticsearch_plugin」,有人說到該問題是 Puppet 既有的問題,並且 workaround 是重啟 puppetserver。

The unfortunate reality (and why I link directly to the upstream Puppet issue tracker) is that this seems endemic to Puppet. I usually observe problems when a native provider is updated or otherwise changes which seems to trigger the behavior as well. The most reliable remediation seems to be restarting either the master or agent, as you mention.

 

嘗試了一下 puppetserver 重啟不一定能夠解決問題,而且該問題是偶發出現,並不是每次都會錯,看起來在官方沒有想解這個問題,然後 workaround 也不是很好 …

The odd thing is that sometimes I restart the puppetserver service and the same issue crops up immediately. I’ve pushed version 6.2.2 of this module out to all of my environments and it has been that way for quite some time, I can’t think of how the native provider would be changing. It’s a pretty frustrating issue as it causes the entire agent run to bail.

 

由於看起來不是單一 module 的情況,所以只好轉戰其他 module 看看是否有類似的問題,結果在 voxpupuli/puppet-rabbitmq 看到也有人反應「Autoload error that sometimes occurs on Puppet Enterprise 2017.2.2」,這邊有談到是因為 puppet types 的問題:

So after 5 days, removing my_environment/.resource_types/rabbitmq_plugin.pp ensured the error didn’t happen. I added it back today and got 2 of the errors about 2 hours after. That supports my theory that it started after running puppet generate types in my case.

With the file back, I also tried to manage some of the RabbitMQ plugins with the module to see if something was “empty” and it having a value would get passed the error. My first noop try with that showed the error, so I don’t believe it is that is a work around.

 

實際測試使用 puppet generate types 去重新產生 resource types 可以正常的解決問題,但是每次 puppetserver restart 都需要這個動作

 

所以最後的解決辦法就是在 CD 加上 puppet generate types 讓 resource types 重新產生,記得要在 puppetserver start 之後,搞定。

 

 

 

 

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

彙整

分類

open all | close all

License

訂閱 Mr. 沙先生 的文章

輸入你的 email 用於訂閱

%d 位部落客按了讚: