[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:34:41 UTC 2010
The following commit has been merged in the upstream branch:
commit e6709da4fed6e671dab5af0db3cb87da5b27555e
Author: Jesse Wolfe <jes5199 at gmail.com>
Date: Wed Jun 23 15:19:36 2010 -0700
[#3409] fix test failures from ldap environment patch
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index 2bb156e..c9c922b 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -207,7 +207,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
if information[:environment]
name_env = information[:environment]
else
- name_env = production
+ name_env = 'production'
end
parent_info = name2hash(parent,name_env,'parent')
diff --git a/spec/unit/indirector/node/ldap.rb b/spec/unit/indirector/node/ldap.rb
index 953a8c2..6f53b6c 100755
--- a/spec/unit/indirector/node/ldap.rb
+++ b/spec/unit/indirector/node/ldap.rb
@@ -23,16 +23,17 @@ describe Puppet::Node::Ldap do
end
it "should convert the hostname into a search filter" do
- entry = stub 'entry', :dn => 'cn=mynode.domain.com,ou=hosts,dc=madstop,dc=com', :vals => %w{}, :to_hash => {}
+ entry = stub 'entry', :dn => 'cn=mynode.domain.com,ou=hosts,dc=madstop,dc=com', :vals => %w{}, :to_hash => {"environment" => 'production'}
@searcher.expects(:ldapsearch).with("(&(objectclass=puppetClient)(cn=#{@name}))").yields entry
- @searcher.name2hash(@name)
+ @searcher.name2hash(@name, 'production', 'parent')
end
it "should convert any found entry into a hash" do
- entry = stub 'entry', :dn => 'cn=mynode.domain.com,ou=hosts,dc=madstop,dc=com', :vals => %w{}, :to_hash => {}
+ entry = stub 'entry', :dn => 'cn=mynode.domain.com,ou=hosts,dc=madstop,dc=com', :vals => %w{}, :to_hash => {"environment" => 'production'}
@searcher.expects(:ldapsearch).with("(&(objectclass=puppetClient)(cn=#{@name}))").yields entry
- @searcher.expects(:entry2hash).with(entry).returns "myhash"
- @searcher.name2hash(@name).should == "myhash"
+ myhash = {"myhash" => true, :environment => 'production'}
+ @searcher.expects(:entry2hash).with(entry).returns myhash
+ @searcher.name2hash(@name, 'production', 'parent').should == myhash
end
# This heavily tests our entry2hash method, so we don't have to stub out the stupid entry information any more.
@@ -127,20 +128,20 @@ describe Puppet::Node::Ldap do
end
it "should search first for the provided key" do
- @searcher.expects(:name2hash).with("mynode.domain.com").returns({})
+ @searcher.expects(:name2hash).with("mynode.domain.com", 'production', 'child').returns({})
@searcher.find(@request)
end
it "should search for the short version of the provided key if the key looks like a hostname and no results are found for the key itself" do
- @searcher.expects(:name2hash).with("mynode.domain.com").returns(nil)
- @searcher.expects(:name2hash).with("mynode").returns({})
+ @searcher.expects(:name2hash).with("mynode.domain.com", 'production', 'child').returns(nil)
+ @searcher.expects(:name2hash).with("mynode", 'production', 'child').returns({})
@searcher.find(@request)
end
it "should search for default information if no information can be found for the key" do
- @searcher.expects(:name2hash).with("mynode.domain.com").returns(nil)
- @searcher.expects(:name2hash).with("mynode").returns(nil)
- @searcher.expects(:name2hash).with("default").returns({})
+ @searcher.expects(:name2hash).with("mynode.domain.com", 'production', 'child').returns(nil)
+ @searcher.expects(:name2hash).with("mynode", 'production', 'child').returns(nil)
+ @searcher.expects(:name2hash).with("default", 'production', 'child').returns({})
@searcher.find(@request)
end
@@ -161,8 +162,8 @@ describe Puppet::Node::Ldap do
end
it "should create the node with the correct name, even if it was found by a different name" do
- @searcher.expects(:name2hash).with("mynode.domain.com").returns nil
- @searcher.expects(:name2hash).with("mynode").returns @result
+ @searcher.expects(:name2hash).with("mynode.domain.com", 'production', 'child').returns nil
+ @searcher.expects(:name2hash).with("mynode", 'production', 'child').returns @result
Puppet::Node.expects(:new).with("mynode.domain.com").returns @node
@searcher.find(@request)
@@ -212,9 +213,9 @@ describe Puppet::Node::Ldap do
@parent = {:classes => [], :parameters => {}}
@parent_parent = {:classes => [], :parameters => {}}
- @searcher.stubs(:name2hash).with(@name).returns(@entry)
- @searcher.stubs(:name2hash).with('parent').returns(@parent)
- @searcher.stubs(:name2hash).with('parent_parent').returns(@parent_parent)
+ @searcher.stubs(:name2hash).with{|name, env, mode| name == @name}.returns(@entry)
+ @searcher.stubs(:name2hash).with{|name, env, mode| name == 'parent'}.returns(@parent)
+ @searcher.stubs(:name2hash).with{|name, env, mode| name == 'parent_parent'}.returns(@parent_parent)
@searcher.stubs(:parent_attribute).returns(:parent)
end
@@ -222,16 +223,13 @@ describe Puppet::Node::Ldap do
it "should search for the parent node" do
@entry[:parent] = "parent"
- @searcher.expects(:name2hash).with(@name).returns @entry
- @searcher.expects(:name2hash).with('parent').returns @parent
-
@searcher.find(@request)
end
it "should fail if the parent cannot be found" do
@entry[:parent] = "parent"
- @searcher.expects(:name2hash).with('parent').returns nil
+ @searcher.expects(:name2hash).with('parent', 'production', 'parent').returns nil
proc { @searcher.find(@request) }.should raise_error(Puppet::Error)
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list