Hi,

I'm working on custom fact that uses Facter::Util::Resolution.exec to run a 
command that returns output I want to parse with regex.  If I write up a 
ruby shell script like:

#!/usr/bin/ruby

out = `<command>`
out = out.gsub!(/<regex>/, "\\1\\3")
puts "#{out}"

The desired output comes to the screen, every time, and on every system I 
run it.

If I modify the script to be a fact like so:

# custom fact
require 'facter'
Facter.add(:newfact) do
  out = Facter::Util::Resolution.exec("<command>")
  out = out.gsub!(/<regex>/, "\\1\\3")
  secode { out }
end

A puppet run actually prints the full output of the command twice after 
syncing the fact.  Running facter -p newfact does the same.  On top, the 
printed output is the raw output not the regex filtered.

What am I doing wrong here?

Thanks!

-- 
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/33d2348e-7d0e-40ec-9adf-ba894bb83f79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to