This is on Amazon Linux on EC2 - Puppet Agent and master are at 2.7.25

Manual runs of facter and puppet `puppet agent -t` complete successfully 
and produce no errors. how were if puppet runs either as service daemon or 
cron I get the above error in the log.

Here is the error

/var/log/messages
Nov 17 21:47:36 servername puppet-agent[123]: Starting Puppet client 
version 2.7.25
Nov 17 21:47:36 servername puppet-agent[123]: Could not run Puppet 
configuration client: *Could not retrieve local facts: private method 
`scan' called for nil:NilClass*








This is the custom fact which is producing the error
Any reason why this code would run successfully manually but fail a daemon?



cat /usr/lib/ruby/site_ruby/1.8/facter/ec2tags.rb

require 'facter'


if Facter.value("ec2_instance_id") != nil
  instance_id = Facter.value("ec2_instance_id")
  region = Facter.value("ec2_placement_availability_zone")[0..-2]
  tags = Facter::Util::Resolution.exec("ec2dtag -O key -W secret_key 
--filter \"resource-id=#{instance_id}\" --region #{region} | cut -f 4-|awk 
'BEGIN{FS=\" \";OFS=\"|\"} {$1=$1; print $0}'")
  tags.scan(/(.*)\|+(.*)/) do |key, value|
   fact = "ec2_tag_#{key}"
   Facter.add(fact) { setcode { value } }
  end
end



-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fb903886-e6ed-4d32-a1a2-7aed6e465fdb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to