From 14c3bc7934fc707299811537816c55e788f89c6d Mon Sep 17 00:00:00 2001 From: John Bellone Date: Sun, 8 Feb 2015 20:11:31 -0500 Subject: [PATCH] Update service HWRP and recipe. --- libraries/provider_consul_service.rb | 6 ------ libraries/provider_consul_service_sysvinit.rb | 1 + libraries/resource_consul_service.rb | 6 ++++-- recipes/default.rb | 10 +++++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libraries/provider_consul_service.rb b/libraries/provider_consul_service.rb index d422e714..bddc60d1 100644 --- a/libraries/provider_consul_service.rb +++ b/libraries/provider_consul_service.rb @@ -6,14 +6,8 @@ def whyrun_supported? end action :create do - consul_client 'consul' do - action :create - end end action :delete do - consul_client 'consul' do - action :delete - end end end diff --git a/libraries/provider_consul_service_sysvinit.rb b/libraries/provider_consul_service_sysvinit.rb index 2e72a027..a1ea99ad 100644 --- a/libraries/provider_consul_service_sysvinit.rb +++ b/libraries/provider_consul_service_sysvinit.rb @@ -1,2 +1,3 @@ class Chef::Provider::ConsulServiceSysvinit < Chef::Provider::ConsulService + end diff --git a/libraries/resource_consul_service.rb b/libraries/resource_consul_service.rb index 1e4a0c60..e43fc91a 100644 --- a/libraries/resource_consul_service.rb +++ b/libraries/resource_consul_service.rb @@ -1,5 +1,7 @@ class Chef::Resource::ConsulService < Chef::Resource::LWRPBase self.resource_name = :consul_service - actions :create, :delete, :start, :stop, :restart - default_action :create + actions :start, :stop, :restart, :enable, :disable, :reload + default_action :start + + attribute :service_name, type: String, name_attribute: true, required: true end diff --git a/recipes/default.rb b/recipes/default.rb index 43ec2df4..1cb56ecc 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -33,9 +33,13 @@ group node['consul']['service_group'] end -consul_client File.join(node['consul']['install_dir'], 'consul') do - provider Chef::Provider::ConsulClientBinary if node['consul']['install_method'] == 'binary' - provider Chef::Provider::ConsulClientSource if node['consul']['install_method'] == 'source' +consul_client Chef::Consul.install_path(node) do + filename Chef::Consul.remote_filename(node) + url Chef::Consul.remote_url(node) + checksum Chef::Consul.remote_checksum(node) + version node['consul']['version'] + user node['consul']['service_user'] + group node['consul']['service_group'] end consul_service 'consul' do