[Pkg-puppet-devel] [facter] 310/352: (maint) Only create LDOM facts if virtinfo available

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:56 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 85a6998694c9c2c1d48f562c4334f067936632c9
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Fri Mar 7 15:15:13 2014 -0800

    (maint) Only create LDOM facts if virtinfo available
---
 lib/facter/ldom.rb     | 2 +-
 spec/unit/ldom_spec.rb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/facter/ldom.rb b/lib/facter/ldom.rb
index b7cb7bb..e10a55a 100644
--- a/lib/facter/ldom.rb
+++ b/lib/facter/ldom.rb
@@ -1,4 +1,4 @@
-if Facter.value(:kernel) == 'SunOS'
+if Facter.value(:kernel) == 'SunOS' and Facter::Core::Execution.which('virtinfo')
   virtinfo = Facter::Core::Execution.exec('virtinfo -ap')
 
   # Convert virtinfo parseable output format to array of arrays.
diff --git a/spec/unit/ldom_spec.rb b/spec/unit/ldom_spec.rb
index 416134c..2aff3ca 100644
--- a/spec/unit/ldom_spec.rb
+++ b/spec/unit/ldom_spec.rb
@@ -15,6 +15,7 @@ describe "ldom fact" do
     before :each do
       # For virtinfo documentation:
       # http://docs.oracle.com/cd/E23824_01/html/821-1462/virtinfo-1m.html
+      Facter::Core::Execution.stubs(:which).with("virtinfo").returns 'virtinfo'
       Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").
         returns(ldom_fixtures('ldom_v1'))
       Facter.collection.internal_loader.load(:ldom)
@@ -63,7 +64,7 @@ describe "ldom fact" do
 
   describe "when running on non ldom hardware" do
     before :each do
-      Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").returns(nil)
+      Facter::Core::Execution.stubs(:which).with("virtinfo").returns(nil)
       Facter.collection.internal_loader.load(:ldom)
     end
 

-- 
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