I think I've got it

https://www.ruby-forum.com/topic/92722


Le 13/01/2015 20:18, Poil a écrit :
lsof when running puppet - /sys/class/net/eth0/operstate is open 2 times :

COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF     NODE NAME
...
puppet 9952 root 4r REG 0,0 4096 5043 /sys/class/net/eth0/operstate puppet 9952 root 5r REG 0,0 4096 5043 /sys/class/net/eth0/operstate

lsof when running facter -p - /sys/class/net/eth0/operstate seem to be open only a time

facter 10657 root 3r REG 0,0 4096 5043 /sys/class/net/eth0/operstate


Le 13/01/2015 20:09, Poil a écrit :
hi,

Some more debug ...

strace  puppet agent -t

open("./interfaces_duplex.rb", O_RDONLY) = 5
close(5)                                = 0
open("./interfaces_duplex.rb", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=439, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ba70b807000
read(5, "    fstate = File.open(File.join"..., 4096) = 439
read(5, "", 4096)                       = 0
close(5)                                = 0
munmap(0x2ba70b807000, 4096)            = 0
open("/sys/class/net/eth0/operstate", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
fstat(5, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ba70b807000
lseek(5, 0, SEEK_CUR)                   = 0
clock_gettime(CLOCK_MONOTONIC, {2364700, 310033350}) = 0
select(6, [5], [], [], {119, 998511}





Le 13/01/2015 14:34, Benjamin DUPUIS a écrit :
Hi,

I've this custom fact,
- it's working fine when running via puppet on Debian 6-7, Centos/Rhel 6
- it's going on timeout when running via puppet on Rhel5. "Warning: Could not load fact file /var/lib/puppet/lib/facter/interfaces_duplex.rb: execution expired"
- it's working fine when I get it via "facter -p" on all my Linux

Is anyone have an idea why ? All my nodes are running puppet 3.6.2 (package from puppetlabs)


cat /var/lib/puppet/lib/facter/interfaces_duplex.rb
if Facter.value(:kernel) == 'Linux' and Facter.value(:virtual) =~ /^(physical|vmware|xen0)/
  Dir.glob('/sys/class/net/{eth,em}?').each do |iface|
    fstate = File.open(File.join(iface,'operstate'))
    state = fstate.read
    if state.strip() == 'up'
      Facter.add("duplex_" + File.basename(iface)) do
        confine :kernel => 'Linux'
        setcode do
          fduplex = File.open(File.join(iface,'duplex'))
          if fduplex
            duplex = fduplex.read
            duplex.strip()
          end
        end
      end
      Facter.add("speed_" + File.basename(iface)) do
        confine :kernel => 'Linux'
        setcode do
          fspeed = File.open(File.join(iface,'speed'))
          if fspeed
            speed = fspeed.read
            speed.strip()
          end
        end
      end
    end
  end
end

Best regards,
Benjamin
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/54B51EF0.707%40quake.fr <https://groups.google.com/d/msgid/puppet-users/54B51EF0.707%40quake.fr?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/54B56D7B.4070205%40quake.fr <https://groups.google.com/d/msgid/puppet-users/54B56D7B.4070205%40quake.fr?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/54B56F78.3030706%40quake.fr <https://groups.google.com/d/msgid/puppet-users/54B56F78.3030706%40quake.fr?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/54B59B26.6040704%40quake.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to