Open vchepkov opened 2 hours ago
I am no ruby expert, but maybe something like this?
cmdline_path = Dir.glob('/proc/[0-9]*/cmdline').find do |path|
begin
File.read(path).split("\0").first == '/opt/puppetlabs/puppet/bin/pxp-agent'
rescue Errno::ENOENT
next
end
end
Agent produces error messages randomly:
The problem comes from this code: https://github.com/puppetlabs/puppetlabs-pe_status_check/blob/main/lib/facter/agent_status_check.rb#L34 because the list of files between the Dir.glob and File.read operations can change. An exception handling should be added