]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/chef/templates/default/client.rb.erb
Cope with gems needed for chef reporting not being installed
[chef.git] / cookbooks / chef / templates / default / client.rb.erb
index c276ed6c071fa1c33b61b13538a1de900ab96735..92c96feb3ad61ca9e70900a1d220eff1e211e31e 100644 (file)
@@ -9,10 +9,6 @@
 
 Encoding.default_external = Encoding::UTF_8
 
-# Load supporting code for report handlers
-
-require "/etc/chef/report"
-
 # Log at level info
 
 log_level :info
@@ -29,15 +25,27 @@ ssl_verify_mode :verify_peer
 
 chef_server_url "https://chef.openstreetmap.org"
 
-# Create report handler
+# Make our plugins visible to ohai
 
-email_handler = Chef::Handler::Email.new(:to => "tom@compton.nu")
+Ohai::Config[:plugin_path] << "<%= node[:ohai][:plugin_dir] %>"
 
-# Configure report handlers
+begin
 
-exception_handlers << email_handler
-report_handlers << email_handler
+  # Load supporting code for report handlers
 
-# Make our plugins visible to ohai
+  require "/etc/chef/report"
 
-Ohai::Config[:plugin_path] << "<%= node[:ohai][:plugin_dir] %>"
+  # Create report handler
+
+  email_handler = Chef::Handler::Email.new(:to => "tom@compton.nu")
+
+  # Configure report handlers
+
+  exception_handlers << email_handler
+  report_handlers << email_handler
+
+rescue
+
+  # Ignore errors in case required gems not installed yet
+
+end