Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install plugin twice #408

Closed
scalp42 opened this issue Dec 9, 2015 · 6 comments
Closed

Can't install plugin twice #408

scalp42 opened this issue Dec 9, 2015 · 6 comments

Comments

@scalp42
Copy link
Contributor

scalp42 commented Dec 9, 2015

Getting the following when trying to install twice a plugin:

 * elasticsearch_plugin[royrusso/elasticsearch-HQ] action install

    ================================================================================
    Error executing action `install` on resource 'elasticsearch_plugin[royrusso/elasticsearch-HQ]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '74'
    ---- Begin output of ["/usr/share/elasticsearch/bin/plugin", "install", "royrusso/elasticsearch-HQ"] ----
    STDOUT: -> Installing royrusso/elasticsearch-HQ...
    Trying https://github.com/royrusso/elasticsearch-HQ/archive/master.zip ...
    Downloading ..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
    Verifying https://github.com/royrusso/elasticsearch-HQ/archive/master.zip checksums if available ...
    NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
    ERROR: plugin directory /usr/share/elasticsearch/plugins/hq already exists. To update the plugin, uninstall it first using 'remove hq' command
    STDERR:
    ---- End output of ["/usr/share/elasticsearch/bin/plugin", "install", "royrusso/elasticsearch-HQ"] ----
    Ran ["/usr/share/elasticsearch/bin/plugin", "install", "royrusso/elasticsearch-HQ"] returned 74

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/elasticsearch/libraries/provider_plugin.rb:43:in `block in <class:PluginProvider>'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/gz-elastic/recipes/plugins.rb

     11:   elasticsearch_plugin plugin_name do
     12:     url if plugin_config['url']
     13:     action :install
     14:   end
     15: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/gz-elastic/recipes/plugins.rb:11:in `block in from_file'

    elasticsearch_plugin("royrusso/elasticsearch-HQ") do
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :elasticsearch_plugin
      cookbook_name "gz-elastic"
      recipe_name "plugins"
    end
@scalp42
Copy link
Contributor Author

scalp42 commented Dec 9, 2015

Need to be:

 elasticsearch_plugin("hq") do
      url "https://github.com/royrusso/elasticsearch-HQ"
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :elasticsearch_plugin
      cookbook_name "gz-elastic"
      recipe_name "plugins"
    end

@scalp42 scalp42 closed this as completed Dec 9, 2015
@martinb3
Copy link
Contributor

martinb3 commented Dec 9, 2015

Hello! Indeed, the plugin name is technically just 'hq', and there's no API we have to figure out the plugin directory's name or if the plugin is already installed.

@scalp42 scalp42 reopened this Dec 10, 2015
@scalp42
Copy link
Contributor Author

scalp42 commented Dec 10, 2015

Hi @martinb3

Unfortunately, I'm still running into the same issue:

  elasticsearch_plugin 'royrusso/elasticsearch-HQ' do
    name 'hq'
  end

Error:

================================================================================
Error executing action `install` on resource 'elasticsearch_plugin[royrusso/elasticsearch-HQ]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '74'
---- Begin output of ["/usr/share/elasticsearch/bin/plugin", "install", "royrusso/elasticsearch-HQ"] ----
STDOUT: -> Installing royrusso/elasticsearch-HQ...
Trying https://github.com/royrusso/elasticsearch-HQ/archive/master.zip ...
Downloading ....................................................................................................................................DONE
Verifying https://github.com/royrusso/elasticsearch-HQ/archive/master.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
ERROR: plugin directory /usr/share/elasticsearch/plugins/hq already exists. To update the plugin, uninstall it first using 'remove hq' command
STDERR:
---- End output of ["/usr/share/elasticsearch/bin/plugin", "install", "royrusso/elasticsearch-HQ"] ----
Ran ["/usr/share/elasticsearch/bin/plugin", "install", "royrusso/elasticsearch-HQ"] returned 74

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/elasticsearch/libraries/provider_plugin.rb:43:in `block in <class:PluginProvider>'

@scalp42
Copy link
Contributor Author

scalp42 commented Dec 10, 2015

I noticed that it returns a code 74 when plugin already exists, wondering if we could do something like this:

shell_out!("#{es_conf.path_bin[es_install.type]}/plugin install #{url}".split(' '), user: es_user.username, group: es_user.groupname, :returns => [0,74])

Pretty much either accept 74 as a valid return code (which I think we should) or parse the exception as well (less pretty).

Let me know what you think, I can make a PR for it in case.

@martinb3
Copy link
Contributor

@scalp42 Can you try this way?

 elasticsearch_plugin 'hq' do
   url 'royrusso/elasticsearch-HQ'
 end

@scalp42
Copy link
Contributor Author

scalp42 commented Dec 10, 2015

@martinb3 I had the https in the URL.

Working!

@scalp42 scalp42 closed this as completed Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants