From 20b1d96394c737b7245f39e9530ee0c84fe25041 Mon Sep 17 00:00:00 2001 From: xiaodongwang Date: Sun, 5 Oct 2014 12:23:38 -0700 Subject: [PATCH] fix collectd break on ubuntu Change-Id: I7ce57fc77662c59c488487c5324e9f7d6003706e --- chef/cookbooks/collectd/recipes/client.rb | 10 ++++++---- chef/cookbooks/collectd/recipes/default.rb | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/chef/cookbooks/collectd/recipes/client.rb b/chef/cookbooks/collectd/recipes/client.rb index 3ab309c..2445f52 100644 --- a/chef/cookbooks/collectd/recipes/client.rb +++ b/chef/cookbooks/collectd/recipes/client.rb @@ -18,13 +18,15 @@ # include_recipe "collectd" -if node["collectd"].attribute?("rhel") or node["collectd"].attribute?("debian") - case node["platform_family"] - when "rhel" +case node["platform_family"] +when "rhel" + if node["collectd"].attribute?("rhel") if not node["collectd"]["rhel"]["plugins"].nil? node.override["collectd"]["plugins"]=node["collectd"]["rhel"]["plugins"].to_hash end - when "debian" + end +when "debian" + if node["collectd"].attribute?("debian") if not node["collectd"]["debian"]["plugins"].nil? node.override["collectd"]["plugins"]=node["collectd"]["debian"]["plugins"].to_hash end diff --git a/chef/cookbooks/collectd/recipes/default.rb b/chef/cookbooks/collectd/recipes/default.rb index 439b457..b547875 100644 --- a/chef/cookbooks/collectd/recipes/default.rb +++ b/chef/cookbooks/collectd/recipes/default.rb @@ -31,6 +31,12 @@ when "rhel" command "yum -y update" action :run end +when "debian" + execute "apt-update" do + command "apt-get update" + ignore_failure true + action :run + end end node[:collectd][:package_name].each do |pkg|