Skip to content

Instantly share code, notes, and snippets.

@obazoud
Created October 28, 2014 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obazoud/1d3baa805a2d3d8ab8ae to your computer and use it in GitHub Desktop.
Save obazoud/1d3baa805a2d3d8ab8ae to your computer and use it in GitHub Desktop.
Restart carbon-cache if configuration changed
diff --git a/providers/service_runit.rb b/providers/service_runit.rb
index 5352726..1437a10 100644
--- a/providers/service_runit.rb
+++ b/providers/service_runit.rb
@@ -31,6 +31,10 @@ action :disable do
set_updated { manage_runit_service(:disable) }
end
+action :restart do
+ set_updated { manage_runit_service(:restart) }
+end
+
def manage_runit_service(resource_action)
runit_service(new_resource.service_name) do
cookbook "graphite"
diff --git a/recipes/_carbon_config.rb b/recipes/_carbon_config.rb
index 0feb4b0..4383fe3 100644
--- a/recipes/_carbon_config.rb
+++ b/recipes/_carbon_config.rb
@@ -35,4 +35,6 @@ file "storage-schemas.conf" do
action :nothing
end
-graphite_storage_conf_accumulator "default"
+graphite_storage_conf_accumulator "default" do
+ notifies :restart, "graphite_service[cache]"
+end
diff --git a/resources/service.rb b/resources/service.rb
index 29b0a86..1ff28cd 100644
--- a/resources/service.rb
+++ b/resources/service.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-actions :enable, :disable
+actions :enable, :disable, :restart
default_action :enable
attribute :name, :kind_of => String, :default => nil, :name_attribute => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment