Hi! Does the following do what you might expect? fact_name = 'noop' Facter.add(fact_name) do setcode do utc_hour = %x{/bin/date -u +"%H"}.chomp.to_i environment = Facter.value(:environment) #puts "env = #{environment}" if environment.match("test|dev|qa") result = "false" else if utc_hour.between?(1,10) result = "false" else result = "true" end end #puts "result #{result}" result end end
On Fri, Mar 16, 2012 at 10:56 AM, Jemmorey <jemmo...@gmail.com> wrote: > Would anyone please assist me on this one? This fact seems to work, but > it doesn't return when called directly via facter --puppet noop, but the > resulting facts end up in the reports. > > I'm at wits end with this. Thanks! > > <snip> > utc_hour = Facter::Util::Resolution.exec(%q</bin/date -u +"%H">).chomp > > > Facter.add(:noop) do > setcode do > environment = Facter.value(:environment) > if environment.match("test|dev|qa") > result = false > else > if utc_hour.match("01|02|03|04|05|06|07|08|09|10") > result = false > else > result = true > end > end > result > end > end > </snip> > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/Ubou1ggrLusJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.