Skip to content

Commit

Permalink
Merge pull request #31 from mohitsethi/master
Browse files Browse the repository at this point in the history
added LWRP: elasticsearch_plugin
  • Loading branch information
dearing committed Sep 29, 2015
2 parents 86a0545 + 0dd536b commit 4647eda
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions libraries/provider_elasticsearch_plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Chef
class Provider
class ElasticsearchPlugin < Chef::Provider::LWRPBase
use_inline_resources if defined?(use_inline_resources)
provides :elasticsearch_plugin if Chef::Provider.respond_to?(:provides)
service_name = 'elasticsearch'

action :install do
home_dir = "#{new_resource.path}/elasticsearch-#{new_resource.version}"
execute "install plugin #{new_resource.name}" do
command "#{home_dir}/bin/plugin -install #{new_resource.name}"
end
end

action :remove do
home_dir = "#{new_resource.path}/elasticsearch-#{new_resource.version}"
execute "install plugin #{new_resource.name}" do
command "#{home_dir}/bin/plugin -remove #{new_resource.name}"
end
end
end
end
end
19 changes: 19 additions & 0 deletions libraries/resource_elasticsearch_plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'chef/resource'

class Chef
class Resource
class ElasticsearchPlugin < Chef::Resource::LWRPBase
resource_name :elasticsearch_plugin
default_action :install
actions [:install, :remove]

# used to target any files/templates; default to self
attribute :source, kind_of: String, default: 'ellk'

# Plugin
attribute :name, kind_of: String
attribute :path, kind_of: String, default: '/opt/elasticsearch'

end
end
end

0 comments on commit 4647eda

Please sign in to comment.