lesaux / puppet-kibana4

Code repositoy for the kibana4 puppet module lesaux-kibana4
https://forge.puppetlabs.com/lesaux/kibana4
Apache License 2.0
12 stars 57 forks source link

Bad plugin removal #70

Open peske opened 8 years ago

peske commented 8 years ago

I've noticed in your plugin.pp file, 'absent' case, you are simply removing the plugin directory. Is this everything that needs to be done when uninstalling plugin? I know that kibana command has --remove option that should be used for uninstalling plugins. I don't know if the result is the same in both cases, but I believe that officially recommended way should be used. For this reason I suggest changing 'absent' case as follows:

'absent': {
    exec { "uninstall_kibana_plugin_${name}": 
      command => "/opt/kibana/bin/kibana plugin --remove ${plugin_dest_dir}",
      path    => '/opt/kibana:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
      unless  => "test ! -d ${kibana4_plugin_dir}/${plugin_dest_dir}",
      notify  => Service['kibana'],
    }
    ->
    exec { "remove_kibana_plugin_${name}":
      command => "rm -rf ${kibana4_plugin_dir}/${plugin_dest_dir}",
      path    => '/opt/kibana:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
      unless  => "test ! -d ${kibana4_plugin_dir}/${plugin_dest_dir}",
      notify  => Service['kibana'],
    }
}