diff options
author | Adrien Thebo <adrien@puppetlabs.com> | 2011-03-22 11:20:27 -0700 |
---|---|---|
committer | Adrien Thebo <adrien.thebo@gmail.com> | 2011-04-01 18:36:26 -0700 |
commit | bfc16f6bb9ffbd0064300e647481aab83b7f6212 (patch) | |
tree | 8ccb8a8df30d11a364f1365ac6fe5e351be62617 /lib | |
parent | e42e57c1a5674d77dfa14e10ade9592f5d2052e7 (diff) | |
download | facter-bfc16f6bb9ffbd0064300e647481aab83b7f6212.tar.gz facter-bfc16f6bb9ffbd0064300e647481aab83b7f6212.tar.xz facter-bfc16f6bb9ffbd0064300e647481aab83b7f6212.zip |
(#2714) Added timeout to prtdiag resulution
- prtdiag would hang in specific cases, subsequently hanging facter.
This should kill prtdiag if it takes excessively long.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/virtual.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb index 7c649ba..2801a43 100644 --- a/lib/facter/virtual.rb +++ b/lib/facter/virtual.rb @@ -119,8 +119,11 @@ Facter.add("virtual") do result = "vmware" if pd =~ /VMware/ result = "virtualbox" if pd =~ /VirtualBox/ end - else - output = Facter::Util::Resolution.exec('prtdiag') + elsif Facter.value(:kernel) == 'SunOS' + res = Facter::Util::Resolution.new('prtdiag') + res.timeout = 6 + res.setcode('prtdiag') + output = res.value if not output.nil? output.each_line do |pd| result = "parallels" if pd =~ /Parallels/ |