X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/49d17eb0a36317f7a18650c557bb69f356c0a598..605d99f67ad361a244d3ea699181aa14aca5d9ec:/cookbooks/sysctl/recipes/default.rb diff --git a/cookbooks/sysctl/recipes/default.rb b/cookbooks/sysctl/recipes/default.rb index bf9860e0c..ae22a7b3b 100644 --- a/cookbooks/sysctl/recipes/default.rb +++ b/cookbooks/sysctl/recipes/default.rb @@ -22,20 +22,29 @@ file "/etc/sysctl.d/60-chef.conf" do end if node[:virtualization][:role] != "guest" || - node[:virtualization][:system] != "lxd" + (node[:virtualization][:system] != "lxc" && + node[:virtualization][:system] != "lxd") + keys = [] + + Dir.new("/etc/sysctl.d").each_entry do |file| + next unless file =~ /^99-chef-(.*)\.conf$/ + + keys.push(Regexp.last_match(1)) + end + node[:sysctl].each_value do |group| group[:parameters].each do |key, value| sysctl key do value value # comment group[:comment] end + + keys.delete(key) end end - Dir.new("/etc/sysctl.d").each_entry do |file| - next unless file =~ /^99-chef-(.*)\.conf$/ - - sysctl Regexp.last_match(1) do + keys.each do |key| + sysctl key do action :remove end end