X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/7b9ec4b60ee39614d1d083d7220e76b07d2b275f..36b76f3d038c3862820700711f9db008ca310152:/cookbooks/sysfs/recipes/default.rb diff --git a/cookbooks/sysfs/recipes/default.rb b/cookbooks/sysfs/recipes/default.rb index c6eb15ff5..fa7983d62 100644 --- a/cookbooks/sysfs/recipes/default.rb +++ b/cookbooks/sysfs/recipes/default.rb @@ -8,7 +8,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -28,6 +28,18 @@ template "/etc/sysfs.conf" do source "sysfs.conf.erb" owner "root" group "root" - mode 0644 - notifies :restart, resources(:service => "sysfsutils") + mode 0o644 + notifies :restart, "service[sysfsutils]" +end + +node[:sysfs].each_value do |group| + group[:parameters].each do |key, value| + sysfs_file = "/sys/#{key}" + + file sysfs_file do + content "#{value}\n" + atomic_update false + only_if { File.exist?(sysfs_file) } + end + end end