[Pkg-puppet-devel] [facter] 293/352: (maint) Handle string output in zfs/zpool version facts

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:54 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 893a1c0db6baefef97b7b280bb0f0817fac309d2
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Thu Feb 27 13:59:24 2014 -0800

    (maint) Handle string output in zfs/zpool version facts
---
 lib/facter/zfs_version.rb       | 2 +-
 lib/facter/zpool_version.rb     | 2 +-
 spec/unit/zfs_version_spec.rb   | 2 +-
 spec/unit/zpool_version_spec.rb | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/facter/zfs_version.rb b/lib/facter/zfs_version.rb
index 3427eee..d05e360 100644
--- a/lib/facter/zfs_version.rb
+++ b/lib/facter/zfs_version.rb
@@ -4,7 +4,7 @@ Facter.add('zfs_version') do
   setcode do
     if Facter::Core::Execution.which('zfs')
       zfs_v = Facter::Core::Execution.exec('zfs upgrade -v')
-      zfs_version = zfs_v.scan(/^\s+(\d+)\s+/m).flatten.last unless zfs_v.nil?
+      zfs_version = zfs_v.scan(/^\s+(\d+)\s+/m).flatten.last unless zfs_v.empty?
     end
   end
 end
diff --git a/lib/facter/zpool_version.rb b/lib/facter/zpool_version.rb
index 05a117a..d1b7ede 100644
--- a/lib/facter/zpool_version.rb
+++ b/lib/facter/zpool_version.rb
@@ -4,7 +4,7 @@ Facter.add('zpool_version') do
   setcode do
     if Facter::Core::Execution.which('zpool')
       zpool_v = Facter::Core::Execution.exec('zpool upgrade -v')
-      zpool_version = zpool_v.match(/ZFS pool version (\d+)./).captures.first unless zpool_v.nil?
+      zpool_version = zpool_v.match(/ZFS pool version (\d+)./).captures.first unless zpool_v.empty?
     end
   end
 end
diff --git a/spec/unit/zfs_version_spec.rb b/spec/unit/zfs_version_spec.rb
index 039dfaf..678a419 100644
--- a/spec/unit/zfs_version_spec.rb
+++ b/spec/unit/zfs_version_spec.rb
@@ -50,7 +50,7 @@ describe "zfs_version fact" do
   end
 
   it "should return nil if zfs fails to run" do
-    Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(nil)
+    Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns('')
     Facter.fact(:zfs_version).value.should == nil
   end
 
diff --git a/spec/unit/zpool_version_spec.rb b/spec/unit/zpool_version_spec.rb
index 169bcef..569e4fd 100644
--- a/spec/unit/zpool_version_spec.rb
+++ b/spec/unit/zpool_version_spec.rb
@@ -50,7 +50,7 @@ describe "zpool_version fact" do
   end
 
   it "should return nil if zpool fails to run" do
-    Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(nil)
+    Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns('')
     Facter.fact(:zpool_version).value.should == nil
   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