Skip to content

Commit 6a3adee

Browse files
authored
Merge pull request #244 from vchepkov/cmdline
fix: prevent random failures in agent_status_check
2 parents 658d8a8 + 73ce671 commit 6a3adee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/facter/agent_status_check.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
socket_matches = Set.new(socket_state.scan(%r{ino:(\d+)}).flatten)
3232

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

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

0 commit comments

Comments
 (0)