Vendor the external cookbooks
Knife-Zero doesn't include Berkshelf support, so vendoring everything in the repo is convenient again
This commit is contained in:
28
cookbooks/elasticsearch/libraries/resource_service.rb
Normal file
28
cookbooks/elasticsearch/libraries/resource_service.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
# Chef Resource for declaring a service for Elasticsearch
|
||||
class ElasticsearchCookbook::ServiceResource < Chef::Resource::LWRPBase
|
||||
resource_name :elasticsearch_service
|
||||
provides :elasticsearch_service
|
||||
|
||||
actions(
|
||||
:configure, :remove, # our custom actions
|
||||
:enable, :disable, :start, :stop, :restart, :status # passthrough to service resource
|
||||
)
|
||||
default_action :configure
|
||||
|
||||
# this is what helps the various resources find each other
|
||||
attribute(:instance_name, kind_of: String, default: nil)
|
||||
|
||||
attribute(:service_name, kind_of: String, name_attribute: true)
|
||||
attribute(:args, kind_of: String, default: '-d')
|
||||
|
||||
# service actions
|
||||
attribute(:service_actions, kind_of: [Symbol, String, Array], default: [:enable, :start].freeze)
|
||||
|
||||
# allow overridable init script
|
||||
attribute(:init_source, kind_of: String, default: 'initscript.erb')
|
||||
attribute(:init_cookbook, kind_of: String, default: 'elasticsearch')
|
||||
|
||||
# allow overridable systemd unit
|
||||
attribute(:systemd_source, kind_of: String, default: 'systemd_unit.erb')
|
||||
attribute(:systemd_cookbook, kind_of: String, default: 'elasticsearch')
|
||||
end
|
||||
Reference in New Issue
Block a user