From 63073cfabb6f9a968e876b978e3160a40038cb02 Mon Sep 17 00:00:00 2001 From: Martin Cozzi Date: Mon, 28 Jul 2014 23:01:11 -0700 Subject: [PATCH] Declares Upstart config before declaring the service When converging, Chef looks for /etc/init/statsd.conf to create the service. The file hasn't been created yet which ends up throwing an exception. --- metadata.rb | 2 +- recipes/default.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/metadata.rb b/metadata.rb index b9c21fe..a1956a6 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures statsd' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.3.0' +version '0.3.1' depends 'build-essential' depends 'git' diff --git a/recipes/default.rb b/recipes/default.rb index 14990a0..851cdbf 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -69,6 +69,12 @@ end end +template '/etc/init/statsd.conf' do + source 'upstart.conf.erb' + mode 0644 + notifies :restart, 'service[statsd]', :delayed +end + service 'statsd' do provider Chef::Provider::Service::Upstart restart_command 'stop statsd; start statsd' @@ -102,12 +108,6 @@ notifies :restart, 'service[statsd]', :delayed end -template '/etc/init/statsd.conf' do - source 'upstart.conf.erb' - mode 0644 - notifies :restart, 'service[statsd]', :delayed -end - file node['statsd']['log_file'] do owner node['statsd']['user'] group node['statsd']['group']