[Pkg-puppet-devel] [facter] 03/18: (FACT-765) Constrain windows `id` gid resolution

Stig Sandbeck Mathisen ssm at debian.org
Wed Jan 27 21:12:52 UTC 2016


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

ssm pushed a commit to branch master
in repository facter.

commit 50eac1639468f68e18fdcb38f90a31f71701e783
Author: Reid Vandewiele <reid at puppetlabs.com>
Date:   Mon Jun 15 09:07:46 2015 -0700

    (FACT-765) Constrain windows `id` gid resolution
    
    Windows platforms should not attempt to resolve the gid fact if they
    have an "id" executable in their path. The gid fact should not return a
    value on Windows.
---
 lib/facter/gid.rb     | 2 +-
 spec/unit/gid_spec.rb | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/facter/gid.rb b/lib/facter/gid.rb
index 21f5ff4..aaa23c7 100644
--- a/lib/facter/gid.rb
+++ b/lib/facter/gid.rb
@@ -10,7 +10,7 @@
 
 Facter.add(:gid) do
   confine do
-    Facter::Core::Execution.which('id') && Facter.value(:kernel) != "SunOS"
+    Facter::Core::Execution.which('id') && !["SunOS", "windows"].include?(Facter.value(:kernel))
   end
   setcode { Facter::Core::Execution.exec('id -ng') }
 end
diff --git a/spec/unit/gid_spec.rb b/spec/unit/gid_spec.rb
index 6e35ea9..65ca085 100755
--- a/spec/unit/gid_spec.rb
+++ b/spec/unit/gid_spec.rb
@@ -39,4 +39,13 @@ describe "gid fact" do
       Facter.fact(:gid).value.should == nil
     end
   end
+
+  describe "on windows systems" do
+    it "is not supported" do
+      Facter.fact(:kernel).stubs(:value).returns("windows")
+      Facter::Core::Execution.expects(:which).with('id').returns(true)
+
+      Facter.fact(:gid).value.should == nil
+    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