voxpupuli / puppet-elasticsearch

Elasticsearch Puppet module
Apache License 2.0
404 stars 476 forks source link

elasticsearch_plugin/ruby.rb wrong path to call plugin binary #1172

Closed Bbertatum closed 1 year ago

Bbertatum commented 2 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

Try to install a plugin


   if $plugins {
     $plugin = ['delete-by-query','mapper-attachments']
     elasticsearch::plugin { $plugin: }
   }

This because the exec do not call the right binary to install plugin

As a workaround we linked the path in puppet code :

   if $plugins {
+    file { '/usr/share/elasticsearch/bin/elasticsearch-plugin':
+      ensure => link,
+      target => '/usr/share/elasticsearch/bin/plugin',
+      owner  => 'root',
+      group  => 'root',
+      mode   => '0755',
+    }
     $plugin = ['delete-by-query','mapper-attachments']
     elasticsearch::plugin { $plugin: }
   }

This seems to be in elasticsearch_plugin/ruby.rb at :


# frozen_string_literal: true
require 'puppet/provider/elastic_plugin'
Puppet::Type.type(:elasticsearch_plugin).provide(
  :elasticsearch_plugin,
  parent: Puppet::Provider::ElasticPlugin
) do
  desc <<-END
    Post-5.x provider for Elasticsearch bin/elasticsearch-plugin
    command operations.'
  END
  case Facter.value('osfamily')
  when 'OpenBSD'
    commands plugin: '/usr/local/elasticsearch/bin/elasticsearch-plugin'
    commands es: '/usr/local/elasticsearch/bin/elasticsearch'
    commands javapathhelper: '/usr/local/bin/javaPathHelper'
  else
    commands plugin: '/usr/share/elasticsearch/bin/elasticsearch-plugin'
    commands es: '/usr/share/elasticsearch/bin/elasticsearch'
  end
end

Could this be fixed ? Thanks, best regards

phaedriel commented 1 year ago

I'm not certain to understand issue. I checked deb, linux and rpm distribution on https://www.elastic.co/fr/downloads/past-releases/elasticsearch-8-5-3, i found 'elasticsearch-plugin' in directory 'bin' not 'plugin'. Perhaps oldest version ?

phaedriel commented 1 year ago

"elasticsearch-plugin is only applicable for 5.0 and above. if you are really on 2.4 then you need to use /usr/share/elasticsearch/bin/plugin." on https://discuss.elastic.co/t/missing-plugin-command-in-elastic/61995/5