[Pkg-puppet-devel] [facter] 314/352: (maint) Confine lsbdistdescription to depend on lsb_release

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 92aba9038d5f4424b4495c2369b431ec3637a5e1
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Mon Mar 10 11:50:16 2014 -0700

    (maint) Confine lsbdistdescription to depend on lsb_release
---
 lib/facter/lsbdistdescription.rb     |  4 ++++
 spec/unit/lsbdistdescription_spec.rb | 13 ++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/facter/lsbdistdescription.rb b/lib/facter/lsbdistdescription.rb
index 0250b94..409e76f 100644
--- a/lib/facter/lsbdistdescription.rb
+++ b/lib/facter/lsbdistdescription.rb
@@ -12,6 +12,10 @@
 
 Facter.add(:lsbdistdescription) do
   confine :kernel => [ :linux, :"gnu/kfreebsd" ]
+  confine do
+    Facter::Core::Execution.which("lsb_release")
+  end
+
   setcode do
     if output = Facter::Core::Execution.exec('lsb_release -d -s 2>/dev/null')
       # the output may be quoted (at least it is on gentoo)
diff --git a/spec/unit/lsbdistdescription_spec.rb b/spec/unit/lsbdistdescription_spec.rb
index bca930e..8a4d7c4 100755
--- a/spec/unit/lsbdistdescription_spec.rb
+++ b/spec/unit/lsbdistdescription_spec.rb
@@ -10,16 +10,15 @@ describe "lsbdistdescription fact" do
         Facter.fact(:kernel).stubs(:value).returns kernel
       end
 
-      it "should return the description through lsb_release -d -s 2>/dev/null" do
-        Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns '"Gentoo Base System release 2.1"'
-        Facter.fact(:lsbdistdescription).value.should == 'Gentoo Base System release 2.1'
+      it "returns the description through lsb_release -d -s 2>/dev/null" do
+        Facter::Core::Execution.impl.stubs(:exec).with('lsb_release -d -s 2>/dev/null', anything).returns '"Gentoo Base System release 2.1"'
+        expect(Facter.fact(:lsbdistdescription).value).to eq 'Gentoo Base System release 2.1'
       end
 
-      it "should return nil if lsb_release is not installed" do
-        Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns nil
-        Facter.fact(:lsbdistdescription).value.should be_nil
+      it "returns nil if lsb_release is not installed" do
+        Facter::Core::Execution.stubs(:which).with('lsb_release').returns nil
+        expect(Facter.fact(:lsbdistdescription).value).to be_nil
       end
     end
   end
-
 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