Skip to content

bin/plugin is used insead of bin/elasticsearch-plugin on the first run #1228

@viliusgec

Description

@viliusgec

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.x
  • Ruby: 2.4
  • Distribution: CentOS Linux 7
  • Module version: v8.1.0

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

Initialize elasticsearch class and try adding plugins on the same puppet run:

 class { 'elasticsearch':
 ...
 }

 $plugins.each |String $name, Hash $config| {
   elasticsearch::plugin { $name:
     *         => $config,
   }
 }

What are you seeing

If we try installing plugins on the same run as elasticsearch class is initialized - it uses bin/plugin instead of bin/elasticsearch-plugin
Puppet::Type::Elasticsearch_plugin::ProviderElasticsearch_plugin: file /usr/share/elasticsearch/bin/plugin does not exist
On the second puppet run it does use bin/elasticsearch-plugin

What behavior did you expect instead

/usr/share/elasticsearch/bin/elasticsearch-plugin should be used instead of /usr/share/elasticsearch/bin/plugin

Any additional information you'd like to impart

It looks like this code checks if file exists before puppet run (so before elasticsearch is installed) and will determine to use bin/plugin even when elasticsearch will be installed and elasticsearch-plugin will be added. On the second run it will evaluate again and see that elasticsearch-plugin does exist.

 case Facter.value('osfamily')
  when 'OpenBSD'
    ...
  else
    if File.exist? '/usr/share/elasticsearch/bin/elasticsearch-plugin'
      commands plugin: '/usr/share/elasticsearch/bin/elasticsearch-plugin'
    else
      commands plugin: '/usr/share/elasticsearch/bin/plugin'
     ...

Also using workaround mentioned in this (creating a symlink) issue returns this: CliToolProvider [asticsearch/bin/plugin] not found, available names are [node, shard, plugin, sync-plugins] error. It tries to execute asticsearch/bin/plugin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions