-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide read error on params when you can't read them #78
Conversation
|
Still getting the permission denied warning: kenyon@beta ~ % sudo puppet agent --test
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Notice: /File[/opt/puppetlabs/puppet/cache/lib/facter/kmod.rb]/content:
--- /opt/puppetlabs/puppet/cache/lib/facter/kmod.rb 2022-02-02 17:58:56.180765273 -0800
+++ /tmp/puppet-file20220203-2601855-1i8wwif 2022-02-03 11:30:26.940804768 -0800
@@ -20,7 +20,7 @@
Dir.foreach("/sys/module/#{directory}/parameters") do |param|
next if ['.', '..'].include?(param)
- kmod[directory]['parameters'][param] = File.read("/sys/module/#{directory}/parameters/#{param}").chomp
+ File.readable?("/sys/module/#{directory}/parameters/#{param}") && kmod[directory]['parameters'][param] = File.read("/sys/module/#{directory}/parameters/#{param}").chomp
end
rescue StandardError => e
Facter.warn(e)
Notice: /File[/opt/puppetlabs/puppet/cache/lib/facter/kmod.rb]/content: content changed '{sha256}fe381dbb71ff5b063831169603b60d4bae91633880b5507ff5ff3c7b2170e8c8' to '{sha256}5f8358eb3c933fce630fe4bad46420ed123a25e669e9e332f26d2b10f530fbef'
Info: Loading facts
Warning: Facter: Permission denied @ rb_sysopen - /sys/module/md_mod/parameters/new_array
Info: Caching catalog for beta.kenyonralph.com
Info: Applying configuration version '4e0655397e4b0277f9827a063b07e06f57ea44c0'
Notice: Applied catalog in 15.38 secondsNot sure where it's coming from. Would be nice if the warning could give a line number. |
|
I'm showing that file as write only: ls -l /sys/module/md_mod/parameters/new_array
--w-------. 1 root root 4096 Feb 3 13:53 /sys/module/md_mod/parameters/new_arrayWhat does it look like on your system? |
|
Pushed up a new version to try and do better.... |
|
Same, |
|
No more warnings with commit ba9c4ac. 👍 I can see the warning when running |
Co-authored-by: Raphaël Pinson <github+aem1eeshi1@raphink.net>
Pull Request (PR) description
This should keep from showing errors on params that are write only.
This Pull Request (PR) fixes the following issues
None listed