So far so good. In test environment it actually reports when I run it.
Thank you very much Guy. I'll let you know how it goes in the environments
which actually use noop.
Appreciate the help :)
Jordan
On Friday, March 16, 2012 12:26:23 PM UTC-4, Guy Matz wrote:
>
> 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 > 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/1Aq8fuSvOa4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.