Update the elasticsearch cookbook
This commit is contained in:
41
cookbooks/elasticsearch/resources/install_package.rb
Normal file
41
cookbooks/elasticsearch/resources/install_package.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
include ElasticsearchCookbook::Helpers
|
||||
unified_mode true
|
||||
use 'partial/_common'
|
||||
use 'partial/_package'
|
||||
|
||||
action :install do
|
||||
remote_file "#{Chef::Config[:file_cache_path]}/#{filename_from_url}" do
|
||||
source new_resource.download_url
|
||||
checksum new_resource.download_checksum
|
||||
mode '0644'
|
||||
action :create
|
||||
end
|
||||
|
||||
if platform_family?('debian')
|
||||
dpkg_package filename_from_url do
|
||||
options new_resource.package_options
|
||||
source "#{Chef::Config[:file_cache_path]}/#{filename_from_url}"
|
||||
action :install
|
||||
end
|
||||
else
|
||||
package filename_from_url do
|
||||
options new_resource.package_options
|
||||
source "#{Chef::Config[:file_cache_path]}/#{filename_from_url}"
|
||||
action :install
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
package "#{Chef::Config[:file_cache_path]}/#{filename_from_url}" do
|
||||
action :temove
|
||||
end
|
||||
end
|
||||
|
||||
action_class do
|
||||
include ElasticsearchCookbook::Helpers
|
||||
|
||||
def filename_from_url
|
||||
new_resource.download_url.split('/').last
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user