John, The only examples I've seen of timeout have it outside the setcode block. Can anyone confirm it's behavior depending on whether it's inside or outside setcode? The docs for it are pretty thin.
Thanks, Matt On Tue, Feb 21, 2012 at 8:57 AM, jcbollinger <john.bollin...@stjude.org>wrote: > > > On Feb 20, 7:14 pm, Nathan Powell <nat...@nathanpowell.org> wrote: > > On Mon, Feb 20, 2012 at 5:33 PM, Matt Mencel <m...@techminer.net> wrote: > > > I am trying to write a custom facter for CentOS/RHEL that tells me how > many > > > updates are found on a run of 'yum check-update' > > > > Sorry I replied hastily. After replying I thought about what you're > > trying to do. You don't need all those gyrations to get this data > > > > Tested quickly on RHEL6 and CentOS5: > > > > `sudo yum check-update -q`.split(/\n/).reject{|i| i == ""}.length > > > Alternatively, > > `yum -q check-update | grep '\\w' | wc --lines`.chomp > > sudo is not needed to run yum queries, and avoiding sudo when you > don't need it is good practice. Personally, I find that command a lot > more legible than the Ruby split / reject / length business, too, > though YMMV. > > Also, I think you need to set the timeout inside your setcode block, > not outside. Only that way can you be sure that you'll have the > desired timeout when the fact actually runs. (Otherwise, you might > get the timeout that some other fact sets.) > > > John > > -- > 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. > > -- 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.