sous-chefs / elasticsearch

Development repository for the elasticsearch cookbook
https://supermarket.chef.io/cookbooks/elasticsearch
Other
881 stars 599 forks source link

Plugins not being removed when using elasticsearch_plugin remove resource #712

Open Daren-J-Smith opened 5 years ago

Daren-J-Smith commented 5 years ago

For in-place upgrades, we have written a method for plugin removal when installed plugins do not match the version of ES specified by the version attribute prior to installing new plugins that align with that version:

node['elasticsearch']['plugin'].each
  do |plugin_name, plugin_value|
    properties = ElasticSearchWrapper::PropertyFile.parse("#{node['elasticsearch']['install']['dir']}/elasticsearch/plugins/#{plugin_name}/plugin-descriptor.properties")
    elasticsearch_plugin plugin_name do
        send('action', 'remove')
        not_if { properties[:'elasticsearch.version'].nil? || (properties[:'elasticsearch.version'] == node['elasticsearch']['install']['version']) }
    end
end

This method worked with cookbook version 3.x and ES 5.x, but no longer uninstalls the plugins for cookbook version 4.x and ES 6.x. The plugin removal resource is being executed without error for the client run, but the plugin is not being removed.

martinb3 commented 4 years ago

I think we'd need some more information about what the not_if { ... } is resolving to. If you can confirm it resolves to something falsey, and the elasticsearch_plugin resource is even having an action execute, we can investigate further.

damacus commented 1 year ago

Resolving as part of #767