Skip to content

Commit

Permalink
Merge pull request #244 from vchepkov/cmdline
Browse files Browse the repository at this point in the history
fix: prevent random failures in agent_status_check
  • Loading branch information
MartyEwings authored Nov 25, 2024
2 parents 658d8a8 + 73ce671 commit 6a3adee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/facter/agent_status_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
socket_matches = Set.new(socket_state.scan(%r{ino:(\d+)}).flatten)

# Look for the pxp-agent process in the process table:
cmdline_path = Dir.glob('/proc/[0-9]*/cmdline').find { |path| File.read(path).split("\0").first == '/opt/puppetlabs/puppet/bin/pxp-agent' }
cmdline_path = Dir.glob('/proc/[0-9]*/cmdline').find do |path|
File.read(path).split("\0").first == '/opt/puppetlabs/puppet/bin/pxp-agent'
rescue Errno::ENOENT
next
end

# If no match was found, then the connection to 8142 is not the pxp-agent process because it is not in the process table:
if cmdline_path.nil?
Expand Down

0 comments on commit 6a3adee

Please sign in to comment.