[Pkg-puppet-devel] [facter] 237/352: (maint) refactor solaris virtual fact to use timeouts

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 48ea431e6ac76382a05c53eeaee1ed6097c798aa
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Tue Feb 11 13:23:01 2014 -0800

    (maint) refactor solaris virtual fact to use timeouts
    
    The previous implementation of the solaris virtual fact used a
    resolution inside of a resolution because the original author (me)
    didn't know that the executed code already _was_ a resolution. This
    commit deduplicates the resolution and makes the entire resolution
    timeout like one would expect.
---
 lib/facter/virtual.rb | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 4ef0ba0..416aff1 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -55,13 +55,12 @@ end
 Facter.add("virtual") do
   confine :kernel => 'SunOS'
   has_weight 10
+  self.timeout = 6
+
   setcode do
     next "zone" if Facter::Util::Virtual.zone?
 
-    resolver = Facter::Util::Resolution.new('prtdiag')
-    resolver.timeout = 6
-    resolver.setcode('prtdiag')
-    output = resolver.value
+    output = Facter::Util::Resolution.exec('prtdiag')
     if output
       lines = output.split("\n")
       next "parallels"  if lines.any? {|l| l =~ /Parallels/ }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list