From 248d5ebdf7c2f47a89230e44d7d14ea744b482af Mon Sep 17 00:00:00 2001 From: Martin Cozzi Date: Mon, 28 Jul 2014 23:00:23 -0700 Subject: [PATCH 1/2] Explicitely adds Berkshelf as a dependency in Gemfile Without it rspec cannot complete. --- Gemfile | 1 + Gemfile.lock | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/Gemfile b/Gemfile index ed38f52..d8168e6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source 'https://rubygems.org' +gem 'berkshelf', '~> 3.0' gem 'chef' gem 'chefspec' diff --git a/Gemfile.lock b/Gemfile.lock index bf8388f..37864f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,37 @@ GEM remote: https://rubygems.org/ specs: + addressable (2.3.6) + berkshelf (3.1.4) + addressable (~> 2.3.4) + berkshelf-api-client (~> 1.2) + buff-config (~> 1.0) + buff-extensions (~> 1.0) + buff-shell_out (~> 0.1) + celluloid (~> 0.16.0.pre) + celluloid-io (~> 0.16.0.pre) + faraday (~> 0.9.0) + minitar (~> 0.5.4) + octokit (~> 3.0) + retryable (~> 1.3.3) + ridley (~> 4.0) + solve (~> 1.1) + thor (~> 0.18) + berkshelf-api-client (1.2.0) + faraday (~> 0.9.0) + buff-config (1.0.1) + buff-extensions (~> 1.0) + varia_model (~> 0.4) + buff-extensions (1.0.0) + buff-ignore (1.1.1) + buff-ruby_engine (0.1.0) + buff-shell_out (0.1.1) + buff-ruby_engine (~> 0.1.0) + celluloid (0.16.0.pre3) + timers (~> 4.0.0) + celluloid-io (0.16.0.pre2) + celluloid (>= 0.16.0.pre) + nio4r (>= 1.0.0) chef (11.12.8) chef-zero (>= 2.0.2, < 2.1) diff-lcs (~> 1.2, >= 1.2.4) @@ -29,29 +60,43 @@ GEM fauxhai (~> 2.0) rspec (~> 3.0) coderay (1.1.0) + dep-selector-libgecode (1.0.2) + dep_selector (1.0.3) + dep-selector-libgecode (~> 1.0) + ffi (~> 1.9) diff-lcs (1.2.5) erubis (2.7.0) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) fauxhai (2.2.0) net-ssh ohai + ffi (1.9.3) hashie (2.1.2) highline (1.6.21) + hitimes (1.2.2) ipaddress (0.8.0) json (1.8.1) method_source (0.8.2) mime-types (1.25.1) + minitar (0.5.4) mixlib-authentication (1.3.0) mixlib-log mixlib-cli (1.5.0) mixlib-config (2.1.0) mixlib-log (1.6.0) mixlib-shellout (1.4.0) + multipart-post (2.0.0) + net-http-persistent (2.9.4) net-ssh (2.9.1) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) net-ssh-multi (1.2.0) net-ssh (>= 2.6.5) net-ssh-gateway (>= 1.2.0) + nio4r (1.0.0) + octokit (3.2.0) + sawyer (~> 0.5.3) ohai (7.0.4) ipaddress mime-types (~> 1.16) @@ -71,6 +116,24 @@ GEM rest-client (1.6.8) mime-types (~> 1.16) rdoc (>= 2.4.2) + retryable (1.3.5) + ridley (4.0.0) + addressable + buff-config (~> 1.0) + buff-extensions (~> 1.0) + buff-ignore (~> 1.1) + buff-shell_out (~> 0.1) + celluloid (~> 0.16.0.pre) + celluloid-io (~> 0.16.0.pre) + erubis + faraday (~> 0.9.0) + hashie (>= 2.0.2, < 3.0.0) + json (>= 1.7.7) + mixlib-authentication (>= 1.3.0) + net-http-persistent (>= 2.8) + retryable + semverse (~> 1.1) + varia_model (~> 0.4) rspec (3.0.0) rspec-core (~> 3.0.0) rspec-expectations (~> 3.0.0) @@ -83,13 +146,27 @@ GEM rspec-mocks (3.0.3) rspec-support (~> 3.0.0) rspec-support (3.0.3) + sawyer (0.5.4) + addressable (~> 2.3.5) + faraday (~> 0.8, < 0.10) + semverse (1.1.0) slop (3.6.0) + solve (1.2.1) + dep_selector (~> 1.0) + semverse (~> 1.1) systemu (2.5.2) + thor (0.19.1) + timers (4.0.0) + hitimes + varia_model (0.4.0) + buff-extensions (~> 1.0) + hashie (>= 2.0.2, < 3.0.0) yajl-ruby (1.2.1) PLATFORMS ruby DEPENDENCIES + berkshelf (~> 3.0) chef chefspec From 63073cfabb6f9a968e876b978e3160a40038cb02 Mon Sep 17 00:00:00 2001 From: Martin Cozzi Date: Mon, 28 Jul 2014 23:01:11 -0700 Subject: [PATCH 2/2] 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']