[Pkg-puppet-devel] [facter] 149/352: (fact-207) Issue deprecation warning for ldapname

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:40 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 1da7261da2dfeca26f7763de6da5c2f0c691b6b7
Author: Kylo Ginsberg <kylo at puppetlabs.com>
Date:   Mon Jan 13 18:08:35 2014 -0800

    (fact-207) Issue deprecation warning for ldapname
---
 lib/facter/util/fact.rb     | 4 +++-
 spec/unit/util/fact_spec.rb | 9 +++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/facter/util/fact.rb b/lib/facter/util/fact.rb
index f7fcc1a..1158253 100644
--- a/lib/facter/util/fact.rb
+++ b/lib/facter/util/fact.rb
@@ -30,7 +30,9 @@ class Facter::Util::Fact
     # worst we'll have one.  If we add more, this should be made more efficient.
     options.each do |name, value|
       case name
-      when :ldapname; self.ldapname = value
+        when :ldapname
+          Facter.warnonce("ldapname is deprecated and will be removed in a future version")
+          self.ldapname = value
       else
         raise ArgumentError, "Invalid fact option '%s'" % name
       end
diff --git a/spec/unit/util/fact_spec.rb b/spec/unit/util/fact_spec.rb
index 166817e..c094100 100755
--- a/spec/unit/util/fact_spec.rb
+++ b/spec/unit/util/fact_spec.rb
@@ -12,12 +12,9 @@ describe Facter::Util::Fact do
     Facter::Util::Fact.new("YayNess").name.should == :yayness
   end
 
-  it "should default to its name converted to a string as its ldapname" do
-    Facter::Util::Fact.new("YayNess").ldapname.should == "yayness"
-  end
-
-  it "should allow specifying the ldap name at initialization" do
-    Facter::Util::Fact.new("YayNess", :ldapname => "fooness").ldapname.should == "fooness"
+  it "should issue a deprecation warning for use of ldapname" do
+    Facter.expects(:warnonce).with("ldapname is deprecated and will be removed in a future version")
+    Facter::Util::Fact.new("YayNess", :ldapname => "fooness")
   end
 
   it "should fail if an unknown option is provided" do

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