[Pkg-puppet-devel] [facter] 41/61: (#16668) Ipv6 remove warning
Stig Sandbeck Mathisen
ssm at debian.org
Mon Nov 4 15:02:01 UTC 2013
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit aaebc4e395a09b20d64c6633269e7090c801806a
Author: Rob Reynolds <ferventcoder at gmail.com>
Date: Mon Jul 29 14:21:09 2013 -0500
(#16668) Ipv6 remove warning
If someone does not have ipv6 installed or their machine doesn't have the ipv6
bindings in the registry, we should suppress any messages that result in not
finding that key.
---
lib/facter/util/ip/windows.rb | 3 +++
spec/unit/ipaddress6_spec.rb | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/lib/facter/util/ip/windows.rb b/lib/facter/util/ip/windows.rb
index 42b4db7..805a2bb 100644
--- a/lib/facter/util/ip/windows.rb
+++ b/lib/facter/util/ip/windows.rb
@@ -157,6 +157,7 @@ class Facter::Util::IP::Windows
require 'facter/util/registry'
bindings = {}
+
Facter::Util::Registry.hklm_read(@key, 'Bind').each_with_index do |entry, index|
match_data = entry.match(/\\Device\\(\{.*\})/)
unless match_data.nil?
@@ -165,6 +166,8 @@ class Facter::Util::IP::Windows
end
bindings
+ rescue
+ {}
end
end
diff --git a/spec/unit/ipaddress6_spec.rb b/spec/unit/ipaddress6_spec.rb
index 9173f90..1c9153d 100755
--- a/spec/unit/ipaddress6_spec.rb
+++ b/spec/unit/ipaddress6_spec.rb
@@ -74,6 +74,13 @@ describe "The IPv6 address fact" do
end
end
+ it "should return nil if the system doesn't have ipv6 installed", :if => Facter::Util::Config.is_windows? do
+ Facter::Util::Resolution.any_instance.expects(:warn).never
+ Facter::Util::Registry.stubs(:hklm_read).raises(Win32::Registry::Error, 2)
+
+ Facter.value(:ipaddress6).should == nil
+ end
+
context "when you have one network adapter" do
it "should return empty if ipv6 is not on" do
nic = given_a_valid_windows_nic_with_ipv4_and_ipv6
--
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