summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-11-29 11:55:00 -0800
committerPaul Berry <paul@puppetlabs.com>2010-11-29 12:08:19 -0800
commit14f8160674628340ccfd79baeb84f66cf1e0398a (patch)
tree8acca5047c3e810535786b14c967e51c0623485f
parent52f9ef06507d87026936dc90dcb467a728ebd54f (diff)
downloadpuppet-14f8160674628340ccfd79baeb84f66cf1e0398a.tar.gz
puppet-14f8160674628340ccfd79baeb84f66cf1e0398a.tar.xz
puppet-14f8160674628340ccfd79baeb84f66cf1e0398a.zip
Maint: Refactor tests to use <class>.indirection.<method>
Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. This change affects tests only.
-rwxr-xr-xspec/integration/defaults_spec.rb32
-rwxr-xr-xspec/integration/indirector/catalog/compiler_spec.rb6
-rwxr-xr-xspec/integration/indirector/file_content/file_server_spec.rb6
-rwxr-xr-xspec/integration/indirector/node/ldap_spec.rb2
-rwxr-xr-xspec/integration/network/server/webrick_spec.rb2
-rwxr-xr-xspec/integration/node/facts_spec.rb6
-rwxr-xr-xspec/integration/node_spec.rb18
-rwxr-xr-xspec/integration/resource/catalog_spec.rb8
-rwxr-xr-xspec/integration/ssl/certificate_authority_spec.rb10
-rwxr-xr-xspec/integration/ssl/certificate_request_spec.rb4
-rwxr-xr-xspec/integration/ssl/host_spec.rb4
-rw-r--r--spec/shared_behaviours/file_serving.rb14
-rwxr-xr-xspec/unit/application/agent_spec.rb22
-rwxr-xr-xspec/unit/application/apply_spec.rb20
-rwxr-xr-xspec/unit/application/kick_spec.rb6
-rw-r--r--spec/unit/application/master_spec.rb22
-rwxr-xr-xspec/unit/application/queue_spec.rb6
-rwxr-xr-xspec/unit/application/resource_spec.rb20
-rwxr-xr-xspec/unit/configurer/fact_handler_spec.rb6
-rwxr-xr-xspec/unit/configurer_spec.rb40
-rwxr-xr-xspec/unit/file_bucket/dipper_spec.rb4
-rw-r--r--spec/unit/file_bucket/file_spec.rb16
-rwxr-xr-xspec/unit/indirector/catalog/active_record_spec.rb2
-rwxr-xr-xspec/unit/indirector/catalog/compiler_spec.rb32
-rwxr-xr-xspec/unit/indirector/node/ldap_spec.rb2
-rwxr-xr-xspec/unit/indirector_spec.rb48
-rwxr-xr-xspec/unit/network/http/webrick_spec.rb4
-rwxr-xr-xspec/unit/node/facts_spec.rb6
-rwxr-xr-xspec/unit/node_spec.rb11
-rwxr-xr-xspec/unit/resource/catalog_spec.rb6
-rwxr-xr-xspec/unit/ssl/certificate_authority_spec.rb66
-rwxr-xr-xspec/unit/ssl/host_spec.rb142
-rwxr-xr-xspec/unit/ssl/inventory_spec.rb4
-rw-r--r--spec/unit/status_spec.rb4
-rwxr-xr-xspec/unit/transaction/report_spec.rb7
-rwxr-xr-xspec/unit/type/file/source_spec.rb14
-rwxr-xr-xspec/unit/type/file_spec.rb18
-rwxr-xr-xtest/language/parser.rb12
-rwxr-xr-xtest/language/scope.rb6
-rwxr-xr-xtest/language/snippets.rb2
-rwxr-xr-xtest/network/handler/master.rb6
41 files changed, 292 insertions, 374 deletions
diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb
index 2f30014e8..051f3e528 100755
--- a/spec/integration/defaults_spec.rb
+++ b/spec/integration/defaults_spec.rb
@@ -116,31 +116,31 @@ describe "Puppet defaults" do
describe "when enabling storeconfigs" do
before do
- Puppet::Resource::Catalog.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:cache_class=)
- Puppet::Node.stubs(:cache_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:cache_class=)
+ Puppet::Node.indirection.stubs(:cache_class=)
Puppet.features.stubs(:rails?).returns true
end
it "should set the Catalog cache class to :active_record" do
- Puppet::Resource::Catalog.expects(:cache_class=).with(:active_record)
+ Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:active_record)
Puppet.settings[:storeconfigs] = true
end
it "should not set the Catalog cache class to :active_record if asynchronous storeconfigs is enabled" do
- Puppet::Resource::Catalog.expects(:cache_class=).with(:active_record).never
+ Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:active_record).never
Puppet.settings.expects(:value).with(:async_storeconfigs).returns true
Puppet.settings[:storeconfigs] = true
end
it "should set the Facts cache class to :active_record" do
- Puppet::Node::Facts.expects(:cache_class=).with(:active_record)
+ Puppet::Node::Facts.indirection.expects(:cache_class=).with(:active_record)
Puppet.settings[:storeconfigs] = true
end
it "should set the Node cache class to :active_record" do
- Puppet::Node.expects(:cache_class=).with(:active_record)
+ Puppet::Node.indirection.expects(:cache_class=).with(:active_record)
Puppet.settings[:storeconfigs] = true
end
@@ -152,9 +152,9 @@ describe "Puppet defaults" do
describe "when enabling asynchronous storeconfigs" do
before do
- Puppet::Resource::Catalog.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:cache_class=)
- Puppet::Node.stubs(:cache_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:cache_class=)
+ Puppet::Node.indirection.stubs(:cache_class=)
Puppet.features.stubs(:rails?).returns true
end
@@ -164,26 +164,26 @@ describe "Puppet defaults" do
end
it "should set the Catalog cache class to :queue" do
- Puppet::Resource::Catalog.expects(:cache_class=).with(:queue)
+ Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:queue)
Puppet.settings[:async_storeconfigs] = true
end
it "should set the Facts cache class to :active_record" do
- Puppet::Node::Facts.expects(:cache_class=).with(:active_record)
+ Puppet::Node::Facts.indirection.expects(:cache_class=).with(:active_record)
Puppet.settings[:storeconfigs] = true
end
it "should set the Node cache class to :active_record" do
- Puppet::Node.expects(:cache_class=).with(:active_record)
+ Puppet::Node.indirection.expects(:cache_class=).with(:active_record)
Puppet.settings[:storeconfigs] = true
end
end
describe "when enabling thin storeconfigs" do
before do
- Puppet::Resource::Catalog.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:cache_class=)
- Puppet::Node.stubs(:cache_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:cache_class=)
+ Puppet::Node.indirection.stubs(:cache_class=)
Puppet.features.stubs(:rails?).returns true
end
diff --git a/spec/integration/indirector/catalog/compiler_spec.rb b/spec/integration/indirector/catalog/compiler_spec.rb
index ede502e3c..dcb7eb425 100755
--- a/spec/integration/indirector/catalog/compiler_spec.rb
+++ b/spec/integration/indirector/catalog/compiler_spec.rb
@@ -42,7 +42,7 @@ describe Puppet::Resource::Catalog::Compiler do
Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request)
Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog)
- Puppet::Resource::Catalog.find(request).resource_refs.should == [ @two.ref ]
+ Puppet::Resource::Catalog.indirection.find(request).resource_refs.should == [ @two.ref ]
end
it "should not filter out exported resources when finding a catalog" do
@@ -52,7 +52,7 @@ describe Puppet::Resource::Catalog::Compiler do
Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request)
Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog)
- Puppet::Resource::Catalog.find(request).resource_refs.sort.should == [ @one.ref, @two.ref ]
+ Puppet::Resource::Catalog.indirection.find(request).resource_refs.sort.should == [ @one.ref, @two.ref ]
end
it "should filter out virtual exported resources when finding a catalog" do
@@ -63,6 +63,6 @@ describe Puppet::Resource::Catalog::Compiler do
Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request)
Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog)
- Puppet::Resource::Catalog.find(request).resource_refs.should == [ @two.ref ]
+ Puppet::Resource::Catalog.indirection.find(request).resource_refs.should == [ @two.ref ]
end
end
diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb
index 5de7f1de0..2992c40f2 100755
--- a/spec/integration/indirector/file_content/file_server_spec.rb
+++ b/spec/integration/indirector/file_content/file_server_spec.rb
@@ -34,7 +34,7 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
env = Puppet::Node::Environment.new("foo")
env.stubs(:modulepath).returns [path]
- result = Puppet::FileServing::Content.search("plugins", :environment => "foo", :recurse => true)
+ result = Puppet::FileServing::Content.indirection.search("plugins", :environment => "foo", :recurse => true)
result.should_not be_nil
result.length.should == 2
@@ -54,7 +54,7 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
Puppet.settings[:modulepath] = path
- result = Puppet::FileServing::Content.find("modules/mymod/myfile")
+ result = Puppet::FileServing::Content.indirection.find("modules/mymod/myfile")
result.should_not be_nil
result.should be_instance_of(Puppet::FileServing::Content)
@@ -85,7 +85,7 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
path = File.join(@path, "myfile")
- result = Puppet::FileServing::Content.find("one/myfile", :environment => "foo", :node => "mynode")
+ result = Puppet::FileServing::Content.indirection.find("one/myfile", :environment => "foo", :node => "mynode")
result.should_not be_nil
result.should be_instance_of(Puppet::FileServing::Content)
diff --git a/spec/integration/indirector/node/ldap_spec.rb b/spec/integration/indirector/node/ldap_spec.rb
index e4c0867ad..b13f3c033 100755
--- a/spec/integration/indirector/node/ldap_spec.rb
+++ b/spec/integration/indirector/node/ldap_spec.rb
@@ -10,6 +10,6 @@ describe Puppet::Node::Ldap do
Puppet::Node.indirection.stubs(:terminus).returns ldap
ldap.expects(:ldapsearch).with("(&(objectclass=puppetClient)(puppetclass=foo))")
- Puppet::Node.search "eh", :class => "foo"
+ Puppet::Node.indirection.search "eh", :class => "foo"
end
end
diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb
index 2b14dfb37..37a6bd5c5 100755
--- a/spec/integration/network/server/webrick_spec.rb
+++ b/spec/integration/network/server/webrick_spec.rb
@@ -23,7 +23,7 @@ describe Puppet::Network::Server do
Puppet::SSL::Host.ca_location = :local
ca = Puppet::SSL::CertificateAuthority.new
- ca.generate(Puppet[:certname]) unless Puppet::SSL::Certificate.find(Puppet[:certname])
+ ca.generate(Puppet[:certname]) unless Puppet::SSL::Certificate.indirection.find(Puppet[:certname])
end
after do
diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb
index 4cc2f4c1f..047d9d461 100755
--- a/spec/integration/node/facts_spec.rb
+++ b/spec/integration/node/facts_spec.rb
@@ -16,7 +16,7 @@ describe Puppet::Node::Facts do
terminus = Puppet::Node::Facts.indirection.terminus(:yaml)
terminus.stubs :save
- Puppet::Node.expects(:expire).with("me")
+ Puppet::Node.indirection.expects(:expire).with("me")
facts = Puppet::Node::Facts.new("me")
facts.save
@@ -31,7 +31,7 @@ describe Puppet::Node::Facts do
terminus.expects(:path).with("me").returns "/my/yaml/file"
FileTest.expects(:exist?).with("/my/yaml/file").returns false
- Puppet::Node::Facts.find("me").should be_nil
+ Puppet::Node::Facts.indirection.find("me").should be_nil
end
it "should be able to delegate to the :facter terminus" do
@@ -41,7 +41,7 @@ describe Puppet::Node::Facts do
facts = Puppet::Node::Facts.new("me")
Puppet::Node::Facts.expects(:new).with("me", "facter_hash").returns facts
- Puppet::Node::Facts.find("me").should equal(facts)
+ Puppet::Node::Facts.indirection.find("me").should equal(facts)
end
end
end
diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb
index c635e7f32..0d46259dd 100755
--- a/spec/integration/node_spec.rb
+++ b/spec/integration/node_spec.rb
@@ -24,7 +24,7 @@ describe Puppet::Node do
terminus.expects(:translate).with(@name, "myresults").returns "translated_results"
terminus.expects(:create_node).with(@name, "translated_results").returns @node
- Puppet::Node.find(@name).should equal(@node)
+ Puppet::Node.indirection.find(@name).should equal(@node)
end
it "should be able to use the yaml terminus" do
@@ -36,7 +36,7 @@ describe Puppet::Node do
terminus.expects(:path).with(@name).returns "/my/yaml/file"
FileTest.expects(:exist?).with("/my/yaml/file").returns false
- Puppet::Node.find(@name).should be_nil
+ Puppet::Node.indirection.find(@name).should be_nil
end
it "should have an ldap terminus" do
@@ -51,7 +51,7 @@ describe Puppet::Node do
Puppet::Node.expects(:new).with(@name).returns @node
- Puppet::Node.find(@name).should equal(@node)
+ Puppet::Node.indirection.find(@name).should equal(@node)
end
describe "and using the memory terminus" do
@@ -64,29 +64,29 @@ describe Puppet::Node do
end
it "should find no nodes by default" do
- Puppet::Node.find(@name).should be_nil
+ Puppet::Node.indirection.find(@name).should be_nil
end
it "should be able to find nodes that were previously saved" do
@node.save
- Puppet::Node.find(@name).should equal(@node)
+ Puppet::Node.indirection.find(@name).should equal(@node)
end
it "should replace existing saved nodes when a new node with the same name is saved" do
@node.save
two = Puppet::Node.new(@name)
two.save
- Puppet::Node.find(@name).should equal(two)
+ Puppet::Node.indirection.find(@name).should equal(two)
end
it "should be able to remove previously saved nodes" do
@node.save
- Puppet::Node.destroy(@node.name)
- Puppet::Node.find(@name).should be_nil
+ Puppet::Node.indirection.destroy(@node.name)
+ Puppet::Node.indirection.find(@name).should be_nil
end
it "should fail when asked to destroy a node that does not exist" do
- proc { Puppet::Node.destroy(@node) }.should raise_error(ArgumentError)
+ proc { Puppet::Node.indirection.destroy(@node) }.should raise_error(ArgumentError)
end
end
end
diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb
index 0a3d47a80..206fe909c 100755
--- a/spec/integration/resource/catalog_spec.rb
+++ b/spec/integration/resource/catalog_spec.rb
@@ -30,7 +30,7 @@ describe Puppet::Resource::Catalog do
terminus.expects(:path).with("me").returns "/my/yaml/file"
FileTest.expects(:exist?).with("/my/yaml/file").returns false
- Puppet::Resource::Catalog.find("me").should be_nil
+ Puppet::Resource::Catalog.indirection.find("me").should be_nil
end
it "should be able to delegate to the :compiler terminus" do
@@ -42,10 +42,10 @@ describe Puppet::Resource::Catalog do
node = mock 'node'
node.stub_everything
- Puppet::Node.expects(:find).returns(node)
+ Puppet::Node.indirection.expects(:find).returns(node)
compiler.expects(:compile).with(node).returns nil
- Puppet::Resource::Catalog.find("me").should be_nil
+ Puppet::Resource::Catalog.indirection.find("me").should be_nil
end
it "should pass provided node information directly to the terminus" do
@@ -55,7 +55,7 @@ describe Puppet::Resource::Catalog do
node = mock 'node'
terminus.expects(:find).with { |request| request.options[:use_node] == node }
- Puppet::Resource::Catalog.find("me", :use_node => node)
+ Puppet::Resource::Catalog.indirection.find("me", :use_node => node)
end
end
end
diff --git a/spec/integration/ssl/certificate_authority_spec.rb b/spec/integration/ssl/certificate_authority_spec.rb
index 67ff6f215..622f7ed01 100755
--- a/spec/integration/ssl/certificate_authority_spec.rb
+++ b/spec/integration/ssl/certificate_authority_spec.rb
@@ -47,7 +47,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should be able to generate a new host certificate" do
@ca.generate("newhost")
- Puppet::SSL::Certificate.find("newhost").should be_instance_of(Puppet::SSL::Certificate)
+ Puppet::SSL::Certificate.indirection.find("newhost").should be_instance_of(Puppet::SSL::Certificate)
end
it "should be able to revoke a host certificate" do
@@ -94,7 +94,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should save the signed certificate" do
@ca.sign("luke.madstop.com")
- Puppet::SSL::Certificate.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate)
+ Puppet::SSL::Certificate.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate)
end
it "should be able to sign multiple certificates" do
@@ -107,15 +107,15 @@ describe Puppet::SSL::CertificateAuthority do
@ca.sign("luke.madstop.com")
@ca.sign("other.madstop.com")
- Puppet::SSL::Certificate.find("other.madstop.com").should be_instance_of(Puppet::SSL::Certificate)
- Puppet::SSL::Certificate.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate)
+ Puppet::SSL::Certificate.indirection.find("other.madstop.com").should be_instance_of(Puppet::SSL::Certificate)
+ Puppet::SSL::Certificate.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate)
end
it "should save the signed certificate to the :signeddir" do
@ca.sign("luke.madstop.com")
client_cert = File.join(Puppet[:signeddir], "luke.madstop.com.pem")
- File.read(client_cert).should == Puppet::SSL::Certificate.find("luke.madstop.com").content.to_s
+ File.read(client_cert).should == Puppet::SSL::Certificate.indirection.find("luke.madstop.com").content.to_s
end
it "should save valid certificates" do
diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb
index 8426b9dc5..e04360548 100755
--- a/spec/integration/ssl/certificate_request_spec.rb
+++ b/spec/integration/ssl/certificate_request_spec.rb
@@ -50,13 +50,13 @@ describe Puppet::SSL::CertificateRequest do
@csr.generate(@key)
@csr.save
- Puppet::SSL::CertificateRequest.find("luke.madstop.com").should be_instance_of(Puppet::SSL::CertificateRequest)
+ Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::CertificateRequest)
end
it "should save the completely CSR when saving" do
@csr.generate(@key)
@csr.save
- Puppet::SSL::CertificateRequest.find("luke.madstop.com").content.to_s.should == @csr.content.to_s
+ Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").content.to_s.should == @csr.content.to_s
end
end
diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb
index 05862dfc4..c488eb229 100755
--- a/spec/integration/ssl/host_spec.rb
+++ b/spec/integration/ssl/host_spec.rb
@@ -45,7 +45,7 @@ describe Puppet::SSL::Host do
it "should save the key such that the Indirector can find it" do
@host.generate_key
- Puppet::SSL::Key.find(@host.name).content.to_s.should == @host.key.to_s
+ Puppet::SSL::Key.indirection.find(@host.name).content.to_s.should == @host.key.to_s
end
it "should save the private key into the :privatekeydir" do
@@ -62,7 +62,7 @@ describe Puppet::SSL::Host do
it "should save the certificate request such that the Indirector can find it" do
@host.generate_certificate_request
- Puppet::SSL::CertificateRequest.find(@host.name).content.to_s.should == @host.certificate_request.to_s
+ Puppet::SSL::CertificateRequest.indirection.find(@host.name).content.to_s.should == @host.certificate_request.to_s
end
it "should save the private certificate request into the :privatekeydir" do
diff --git a/spec/shared_behaviours/file_serving.rb b/spec/shared_behaviours/file_serving.rb
index 5f5b2b0af..91594452d 100644
--- a/spec/shared_behaviours/file_serving.rb
+++ b/spec/shared_behaviours/file_serving.rb
@@ -12,7 +12,7 @@ describe "Puppet::FileServing::Files", :shared => true do
term = @indirection.terminus(:rest)
@indirection.stubs(:terminus).with(:rest).returns term
term.expects(:find)
- @test_class.find(uri)
+ @indirection.find(uri)
end
it "should use the rest terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is not 'puppet' or 'apply'" do
@@ -21,7 +21,7 @@ describe "Puppet::FileServing::Files", :shared => true do
Puppet.settings.stubs(:value).with(:name).returns("puppetd")
Puppet.settings.stubs(:value).with(:modulepath).returns("")
@indirection.terminus(:rest).expects(:find)
- @test_class.find(uri)
+ @indirection.find(uri)
end
it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'puppet'" do
@@ -32,7 +32,7 @@ describe "Puppet::FileServing::Files", :shared => true do
Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever")
@indirection.terminus(:file_server).expects(:find)
@indirection.terminus(:file_server).stubs(:authorized?).returns(true)
- @test_class.find(uri)
+ @indirection.find(uri)
end
it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'apply'" do
@@ -43,19 +43,19 @@ describe "Puppet::FileServing::Files", :shared => true do
Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever")
@indirection.terminus(:file_server).expects(:find)
@indirection.terminus(:file_server).stubs(:authorized?).returns(true)
- @test_class.find(uri)
+ @indirection.find(uri)
end
it "should use the file terminus when the 'file' URI scheme is used" do
uri = "file:///fakemod/my/file"
@indirection.terminus(:file).expects(:find)
- @test_class.find(uri)
+ @indirection.find(uri)
end
it "should use the file terminus when a fully qualified path is provided" do
uri = "/fakemod/my/file"
@indirection.terminus(:file).expects(:find)
- @test_class.find(uri)
+ @indirection.find(uri)
end
it "should use the configuration to test whether the request is allowed" do
@@ -66,6 +66,6 @@ describe "Puppet::FileServing::Files", :shared => true do
@indirection.terminus(:file_server).expects(:find)
mount.expects(:allowed?).returns(true)
- @test_class.find(uri, :node => "foo", :ip => "bar")
+ @indirection.find(uri, :node => "foo", :ip => "bar")
end
end
diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb
index 50ef00c57..151d85a58 100755
--- a/spec/unit/application/agent_spec.rb
+++ b/spec/unit/application/agent_spec.rb
@@ -21,9 +21,9 @@ describe Puppet::Application::Agent do
Puppet::Util::Log.stubs(:newdestination)
Puppet::Util::Log.stubs(:level=)
- Puppet::Node.stubs(:terminus_class=)
- Puppet::Node.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:terminus_class=)
+ Puppet::Node.indirection.stubs(:terminus_class=)
+ Puppet::Node.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:terminus_class=)
end
it "should operate in agent run_mode" do
@@ -179,11 +179,11 @@ describe Puppet::Application::Agent do
FileTest.stubs(:exists?).returns(true)
Puppet[:libdir] = "/dev/null/lib"
Puppet::SSL::Host.stubs(:ca_location=)
- Puppet::Transaction::Report.stubs(:terminus_class=)
- Puppet::Transaction::Report.stubs(:cache_class=)
- Puppet::Resource::Catalog.stubs(:terminus_class=)
- Puppet::Resource::Catalog.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:terminus_class=)
+ Puppet::Transaction::Report.indirection.stubs(:terminus_class=)
+ Puppet::Transaction::Report.indirection.stubs(:cache_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:terminus_class=)
@host = stub_everything 'host'
Puppet::SSL::Host.stubs(:new).returns(@host)
Puppet.stubs(:settraps)
@@ -307,13 +307,13 @@ describe Puppet::Application::Agent do
end
it "should tell the report handler to use REST" do
- Puppet::Transaction::Report.expects(:terminus_class=).with(:rest)
+ Puppet::Transaction::Report.indirection.expects(:terminus_class=).with(:rest)
@puppetd.setup
end
it "should tell the report handler to cache locally as yaml" do
- Puppet::Transaction::Report.expects(:cache_class=).with(:yaml)
+ Puppet::Transaction::Report.indirection.expects(:cache_class=).with(:yaml)
@puppetd.setup
end
@@ -325,7 +325,7 @@ describe Puppet::Application::Agent do
end
it "should tell the catalog handler to use cache" do
- Puppet::Resource::Catalog.expects(:cache_class=).with(:yaml)
+ Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:yaml)
@puppetd.setup
end
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb
index f07416378..52b84e6f2 100755
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -57,7 +57,7 @@ describe Puppet::Application::Apply do
Puppet.stubs(:parse_config)
Puppet::FileBucket::Dipper.stubs(:new)
STDIN.stubs(:read)
- Puppet::Transaction::Report.stubs(:cache_class=)
+ Puppet::Transaction::Report.indirection.stubs(:cache_class=)
@apply.options.stubs(:[]).with(any_parameters)
end
@@ -116,7 +116,7 @@ describe Puppet::Application::Apply do
end
it "should tell the report handler to cache locally as yaml" do
- Puppet::Transaction::Report.expects(:cache_class=).with(:yaml)
+ Puppet::Transaction::Report.indirection.expects(:cache_class=).with(:yaml)
@apply.setup
end
@@ -185,14 +185,14 @@ describe Puppet::Application::Apply do
@apply.options.stubs(:[])
@facts = stub_everything 'facts'
- Puppet::Node::Facts.stubs(:find).returns(@facts)
+ Puppet::Node::Facts.indirection.stubs(:find).returns(@facts)
@node = stub_everything 'node'
- Puppet::Node.stubs(:find).returns(@node)
+ Puppet::Node.indirection.stubs(:find).returns(@node)
@catalog = stub_everything 'catalog'
@catalog.stubs(:to_ral).returns(@catalog)
- Puppet::Resource::Catalog.stubs(:find).returns(@catalog)
+ Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog)
STDIN.stubs(:read)
@@ -248,25 +248,25 @@ describe Puppet::Application::Apply do
end
it "should collect the node facts" do
- Puppet::Node::Facts.expects(:find).returns(@facts)
+ Puppet::Node::Facts.indirection.expects(:find).returns(@facts)
@apply.main
end
it "should raise an error if we can't find the node" do
- Puppet::Node::Facts.expects(:find).returns(nil)
+ Puppet::Node::Facts.indirection.expects(:find).returns(nil)
lambda { @apply.main }.should raise_error
end
it "should look for the node" do
- Puppet::Node.expects(:find).returns(@node)
+ Puppet::Node.indirection.expects(:find).returns(@node)
@apply.main
end
it "should raise an error if we can't find the node" do
- Puppet::Node.expects(:find).returns(nil)
+ Puppet::Node.indirection.expects(:find).returns(nil)
lambda { @apply.main }.should raise_error
end
@@ -292,7 +292,7 @@ describe Puppet::Application::Apply do
end
it "should compile the catalog" do
- Puppet::Resource::Catalog.expects(:find).returns(@catalog)
+ Puppet::Resource::Catalog.indirection.expects(:find).returns(@catalog)
@apply.main
end
diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb
index dea7ec147..3a7106338 100755
--- a/spec/unit/application/kick_spec.rb
+++ b/spec/unit/application/kick_spec.rb
@@ -163,7 +163,7 @@ describe Puppet::Application::Kick do
@kick.options.stubs(:[]).with(:all).returns(true)
@kick.stubs(:puts)
- Puppet::Node.expects(:search).with("whatever",:fqdn => :something).returns([])
+ Puppet::Node.indirection.expects(:search).with("whatever",:fqdn => :something).returns([])
@kick.setup
end
@@ -172,7 +172,7 @@ describe Puppet::Application::Kick do
@kick.options.stubs(:[]).with(:all).returns(true)
@kick.stubs(:puts)
- Puppet::Node.expects(:search).with("whatever",:fqdn => nil).returns([])
+ Puppet::Node.indirection.expects(:search).with("whatever",:fqdn => nil).returns([])
@kick.setup
end
@@ -182,7 +182,7 @@ describe Puppet::Application::Kick do
@kick.stubs(:puts)
@kick.classes = ['class']
- Puppet::Node.expects(:search).with("whatever", :class => "class", :fqdn => nil).returns([])
+ Puppet::Node.indirection.expects(:search).with("whatever", :class => "class", :fqdn => nil).returns([])
@kick.setup
end
diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb
index e657445a4..86e38efcb 100644
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@ -14,12 +14,12 @@ describe Puppet::Application::Master do
Puppet::Util::Log.stubs(:newdestination)
Puppet::Util::Log.stubs(:level=)
- Puppet::Node.stubs(:terminus_class=)
- Puppet::Node.stubs(:cache_class=)
- Puppet::Node::Facts.stubs(:terminus_class=)
- Puppet::Node::Facts.stubs(:cache_class=)
- Puppet::Transaction::Report.stubs(:terminus_class=)
- Puppet::Resource::Catalog.stubs(:terminus_class=)
+ Puppet::Node.indirection.stubs(:terminus_class=)
+ Puppet::Node.indirection.stubs(:cache_class=)
+ Puppet::Node::Facts.indirection.stubs(:terminus_class=)
+ Puppet::Node::Facts.indirection.stubs(:cache_class=)
+ Puppet::Transaction::Report.indirection.stubs(:terminus_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
end
it "should operate in master run_mode" do
@@ -183,7 +183,7 @@ describe Puppet::Application::Master do
end
it "should cache class in yaml" do
- Puppet::Node.expects(:cache_class=).with(:yaml)
+ Puppet::Node.indirection.expects(:cache_class=).with(:yaml)
@master.setup
end
@@ -298,7 +298,7 @@ describe Puppet::Application::Master do
it "should compile a catalog for the specified node" do
@master.options[:node] = "foo"
- Puppet::Resource::Catalog.expects(:find).with("foo").returns Puppet::Resource::Catalog.new
+ Puppet::Resource::Catalog.indirection.expects(:find).with("foo").returns Puppet::Resource::Catalog.new
$stdout.stubs(:puts)
@master.compile
@@ -306,7 +306,7 @@ describe Puppet::Application::Master do
it "should convert the catalog to a pure-resource catalog and use 'jj' to pretty-print the catalog" do
catalog = Puppet::Resource::Catalog.new
- Puppet::Resource::Catalog.expects(:find).returns catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).returns catalog
catalog.expects(:to_resource).returns("rescat")
@@ -318,7 +318,7 @@ describe Puppet::Application::Master do
it "should exit with error code 30 if no catalog can be found" do
@master.options[:node] = "foo"
- Puppet::Resource::Catalog.expects(:find).returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).returns nil
@master.expects(:exit).with(30)
$stderr.expects(:puts)
@@ -327,7 +327,7 @@ describe Puppet::Application::Master do
it "should exit with error code 30 if there's a failure" do
@master.options[:node] = "foo"
- Puppet::Resource::Catalog.expects(:find).raises ArgumentError
+ Puppet::Resource::Catalog.indirection.expects(:find).raises ArgumentError
@master.expects(:exit).with(30)
$stderr.expects(:puts)
diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb
index bd0d53ab1..18fd8cea2 100755
--- a/spec/unit/application/queue_spec.rb
+++ b/spec/unit/application/queue_spec.rb
@@ -13,7 +13,7 @@ describe Puppet::Application::Queue do
Puppet::Util::Log.stubs(:newdestination)
Puppet::Util::Log.stubs(:level=)
- Puppet::Resource::Catalog.stubs(:terminus_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
end
it "should ask Puppet::Application to parse Puppet configuration file" do
@@ -80,7 +80,7 @@ describe Puppet::Application::Queue do
@queue.daemon.stubs(:daemonize)
Puppet.stubs(:info)
Puppet.features.stubs(:stomp?).returns true
- Puppet::Resource::Catalog.stubs(:terminus_class=)
+ Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
Puppet.stubs(:settraps)
Puppet.settings.stubs(:print_config?)
Puppet.settings.stubs(:print_config)
@@ -144,7 +144,7 @@ describe Puppet::Application::Queue do
end
it "should configure the Catalog class to use ActiveRecord" do
- Puppet::Resource::Catalog.expects(:terminus_class=).with(:active_record)
+ Puppet::Resource::Catalog.indirection.expects(:terminus_class=).with(:active_record)
@queue.setup
end
diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb
index b6c52b11e..6ab99945c 100755
--- a/spec/unit/application/resource_spec.rb
+++ b/spec/unit/application/resource_spec.rb
@@ -162,21 +162,21 @@ describe Puppet::Application::Resource do
@resource.stubs(:puts)
@resource.host = 'host'
- Puppet::Resource.stubs(:find ).never
- Puppet::Resource.stubs(:search).never
- Puppet::Resource.stubs(:save ).never
+ Puppet::Resource.indirection.stubs(:find ).never
+ Puppet::Resource.indirection.stubs(:search).never
+ Puppet::Resource.indirection.stubs(:save ).never
end
it "should search for resources" do
@resource.command_line.stubs(:args).returns(['type'])
- Puppet::Resource.expects(:search).with('https://host:8139/production/resources/type/', {}).returns([])
+ Puppet::Resource.indirection.expects(:search).with('https://host:8139/production/resources/type/', {}).returns([])
@resource.main
end
it "should describe the given resource" do
@resource.command_line.stubs(:args).returns(['type', 'name'])
x = stub_everything 'resource'
- Puppet::Resource.expects(:find).with('https://host:8139/production/resources/type/name').returns(x)
+ Puppet::Resource.indirection.expects(:find).with('https://host:8139/production/resources/type/name').returns(x)
@resource.main
end
@@ -199,20 +199,20 @@ describe Puppet::Application::Resource do
@resource.stubs(:puts)
@resource.host = nil
- Puppet::Resource.stubs(:find ).never
- Puppet::Resource.stubs(:search).never
- Puppet::Resource.stubs(:save ).never
+ Puppet::Resource.indirection.stubs(:find ).never
+ Puppet::Resource.indirection.stubs(:search).never
+ Puppet::Resource.indirection.stubs(:save ).never
end
it "should search for resources" do
- Puppet::Resource.expects(:search).with('type/', {}).returns([])
+ Puppet::Resource.indirection.expects(:search).with('type/', {}).returns([])
@resource.main
end
it "should describe the given resource" do
@resource.command_line.stubs(:args).returns(['type','name'])
x = stub_everything 'resource'
- Puppet::Resource.expects(:find).with('type/name').returns(x)
+ Puppet::Resource.indirection.expects(:find).with('type/name').returns(x)
@resource.main
end
diff --git a/spec/unit/configurer/fact_handler_spec.rb b/spec/unit/configurer/fact_handler_spec.rb
index 051270144..70918c039 100755
--- a/spec/unit/configurer/fact_handler_spec.rb
+++ b/spec/unit/configurer/fact_handler_spec.rb
@@ -66,7 +66,7 @@ describe Puppet::Configurer::FactHandler do
it "should use the Facts class with the :certname to find the facts" do
Puppet.settings.expects(:value).with(:certname).returns "foo"
- Puppet::Node::Facts.expects(:find).with("foo").returns "myfacts"
+ Puppet::Node::Facts.indirection.expects(:find).with("foo").returns "myfacts"
@facthandler.stubs(:reload_facter)
@facthandler.find_facts.should == "myfacts"
end
@@ -75,7 +75,7 @@ describe Puppet::Configurer::FactHandler do
@facthandler.expects(:reload_facter)
Puppet.settings.expects(:value).with(:certname).returns "myhost"
- Puppet::Node::Facts.expects(:find).with("myhost")
+ Puppet::Node::Facts.indirection.expects(:find).with("myhost")
@facthandler.find_facts
end
@@ -85,7 +85,7 @@ describe Puppet::Configurer::FactHandler do
Puppet.settings.stubs(:value).with(:trace).returns false
Puppet.settings.stubs(:value).with(:certname).returns "myhost"
- Puppet::Node::Facts.expects(:find).raises RuntimeError
+ Puppet::Node::Facts.indirection.expects(:find).raises RuntimeError
lambda { @facthandler.find_facts }.should raise_error(Puppet::Error)
end
diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb
index e34e6fffb..bb3a73994 100755
--- a/spec/unit/configurer_spec.rb
+++ b/spec/unit/configurer_spec.rb
@@ -357,15 +357,15 @@ describe Puppet::Configurer, "when retrieving a catalog" do
end
it "should first look in the cache for a catalog" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.never
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.never
@agent.retrieve_catalog.should == @catalog
end
it "should compile a new catalog if none is found in the cache" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
@agent.retrieve_catalog.should == @catalog
end
@@ -374,7 +374,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do
describe "when not using a REST terminus for catalogs" do
it "should not pass any facts when retrieving the catalog" do
@agent.expects(:facts_for_uploading).never
- Puppet::Resource::Catalog.expects(:find).with { |name, options|
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options|
options[:facts].nil?
}.returns @catalog
@@ -385,7 +385,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do
describe "when using a REST terminus for catalogs" do
it "should pass the prepared facts and the facts format as arguments when retrieving the catalog" do
@agent.expects(:facts_for_uploading).returns(:facts => "myfacts", :facts_format => :foo)
- Puppet::Resource::Catalog.expects(:find).with { |name, options|
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options|
options[:facts] == "myfacts" and options[:facts_format] == :foo
}.returns @catalog
@@ -394,7 +394,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do
end
it "should use the Catalog class to get its catalog" do
- Puppet::Resource::Catalog.expects(:find).returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).returns @catalog
@agent.retrieve_catalog
end
@@ -402,20 +402,20 @@ describe Puppet::Configurer, "when retrieving a catalog" do
it "should use its certname to retrieve the catalog" do
Facter.stubs(:value).returns "eh"
Puppet.settings[:certname] = "myhost.domain.com"
- Puppet::Resource::Catalog.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog
@agent.retrieve_catalog
end
it "should default to returning a catalog retrieved directly from the server, skipping the cache" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
@agent.retrieve_catalog.should == @catalog
end
it "should log and return the cached catalog when no catalog can be retrieved from the server" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
Puppet.expects(:notice)
@@ -423,15 +423,15 @@ describe Puppet::Configurer, "when retrieving a catalog" do
end
it "should not look in the cache for a catalog if one is returned from the server" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never
@agent.retrieve_catalog.should == @catalog
end
it "should return the cached catalog when retrieving the remote catalog throws an exception" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh"
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh"
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
@agent.retrieve_catalog.should == @catalog
end
@@ -439,7 +439,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do
it "should log and return nil if no catalog can be retrieved from the server and :usecacheonfailure is disabled" do
Puppet.stubs(:[])
Puppet.expects(:[]).with(:usecacheonfailure).returns false
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
Puppet.expects(:warning)
@@ -447,21 +447,21 @@ describe Puppet::Configurer, "when retrieving a catalog" do
end
it "should return nil if no cached catalog is available and no catalog can be retrieved from the server" do
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
- Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
+ Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
@agent.retrieve_catalog.should be_nil
end
it "should convert the catalog before returning" do
- Puppet::Resource::Catalog.stubs(:find).returns @catalog
+ Puppet::Resource::Catalog.indirection.stubs(:find).returns @catalog
@agent.expects(:convert_catalog).with { |cat, dur| cat == @catalog }.returns "converted catalog"
@agent.retrieve_catalog.should == "converted catalog"
end
it "should return nil if there is an error while retrieving the catalog" do
- Puppet::Resource::Catalog.expects(:find).raises "eh"
+ Puppet::Resource::Catalog.indirection.expects(:find).raises "eh"
@agent.retrieve_catalog.should be_nil
end
diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb
index 799e899e7..4897dc1f8 100755
--- a/spec/unit/file_bucket/dipper_spec.rb
+++ b/spec/unit/file_bucket/dipper_spec.rb
@@ -60,7 +60,7 @@ describe Puppet::FileBucket::Dipper do
bucketfile = stub "bucketfile"
bucketfile.stubs(:to_s).returns "Content"
- Puppet::FileBucket::File.expects(:find).with{|x,opts|
+ Puppet::FileBucket::File.indirection.expects(:find).with{|x,opts|
x == 'md5/DIGEST123'
}.returns(bucketfile)
@@ -111,7 +111,7 @@ describe Puppet::FileBucket::Dipper do
bucketfile = stub "bucketfile"
bucketfile.stubs(:to_s).returns "Content"
- Puppet::FileBucket::File.expects(:find).with{|x,opts|
+ Puppet::FileBucket::File.indirection.expects(:find).with{|x,opts|
x == 'https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123'
}.returns(bucketfile)
diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb
index 3ad70c203..42ed94253 100644
--- a/spec/unit/file_bucket/file_spec.rb
+++ b/spec/unit/file_bucket/file_spec.rb
@@ -97,14 +97,6 @@ describe Puppet::FileBucket::File do
it "should have a :save instance method" do
Puppet::FileBucket::File.new("mysum").should respond_to(:save)
end
-
- it "should respond to :find" do
- Puppet::FileBucket::File.should respond_to(:find)
- end
-
- it "should respond to :destroy" do
- Puppet::FileBucket::File.should respond_to(:destroy)
- end
end
describe "when saving files" do
@@ -195,7 +187,7 @@ describe Puppet::FileBucket::File do
it "should return nil if a file doesn't exist" do
::File.expects(:exist?).with("#{@dir}/contents").returns false
- bucketfile = Puppet::FileBucket::File.find("{md5}#{@digest}")
+ bucketfile = Puppet::FileBucket::File.indirection.find("{md5}#{@digest}")
bucketfile.should == nil
end
@@ -204,7 +196,7 @@ describe Puppet::FileBucket::File do
::File.expects(:exist?).with("#{@dir}/paths").returns false
::File.expects(:read).with("#{@dir}/contents").returns @contents
- bucketfile = Puppet::FileBucket::File.find("{md5}#{@digest}")
+ bucketfile = Puppet::FileBucket::File.indirection.find("{md5}#{@digest}")
bucketfile.should_not == nil
end
@@ -212,7 +204,7 @@ describe Puppet::FileBucket::File do
it "should return nil if a file doesn't exist" do
::File.expects(:exist?).with("#{@dir}/contents").returns false
- bucketfile = Puppet::FileBucket::File.find("md5/#{@digest}")
+ bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{@digest}")
bucketfile.should == nil
end
@@ -221,7 +213,7 @@ describe Puppet::FileBucket::File do
::File.expects(:exist?).with("#{@dir}/paths").returns false
::File.expects(:read).with("#{@dir}/contents").returns @contents
- bucketfile = Puppet::FileBucket::File.find("md5/#{@digest}")
+ bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{@digest}")
bucketfile.should_not == nil
end
diff --git a/spec/unit/indirector/catalog/active_record_spec.rb b/spec/unit/indirector/catalog/active_record_spec.rb
index 4e9d049a1..09e943376 100755
--- a/spec/unit/indirector/catalog/active_record_spec.rb
+++ b/spec/unit/indirector/catalog/active_record_spec.rb
@@ -80,7 +80,7 @@ describe "Puppet::Resource::Catalog::ActiveRecord" do
@host.stubs(:railsmark).yields
@node = stub_everything 'node', :parameters => {}
- Puppet::Node.stubs(:find).returns(@node)
+ Puppet::Node.indirection.stubs(:find).returns(@node)
Puppet::Rails::Host.stubs(:find_by_name).returns @host
@catalog = Puppet::Resource::Catalog.new("foo")
diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb
index 49b8986eb..264af2635 100755
--- a/spec/unit/indirector/catalog/compiler_spec.rb
+++ b/spec/unit/indirector/catalog/compiler_spec.rb
@@ -32,8 +32,8 @@ describe Puppet::Resource::Catalog::Compiler do
node1 = stub 'node1', :merge => nil
node2 = stub 'node2', :merge => nil
compiler.stubs(:compile)
- Puppet::Node.stubs(:find).with('node1').returns(node1)
- Puppet::Node.stubs(:find).with('node2').returns(node2)
+ Puppet::Node.indirection.stubs(:find).with('node1').returns(node1)
+ Puppet::Node.indirection.stubs(:find).with('node2').returns(node2)
compiler.find(stub('request', :key => 'node1', :node => 'node1', :options => {}))
compiler.find(stub('node2request', :key => 'node2', :node => 'node2', :options => {}))
@@ -71,12 +71,12 @@ describe Puppet::Resource::Catalog::Compiler do
@name = "me"
@node = Puppet::Node.new @name
@node.stubs(:merge)
- Puppet::Node.stubs(:find).returns @node
+ Puppet::Node.indirection.stubs(:find).returns @node
@request = stub 'request', :key => @name, :node => @name, :options => {}
end
it "should directly use provided nodes" do
- Puppet::Node.expects(:find).never
+ Puppet::Node.indirection.expects(:find).never
@compiler.expects(:compile).with(@node)
@request.stubs(:options).returns(:use_node => @node)
@compiler.find(@request)
@@ -84,7 +84,7 @@ describe Puppet::Resource::Catalog::Compiler do
it "should use the authenticated node name if no request key is provided" do
@request.stubs(:key).returns(nil)
- Puppet::Node.expects(:find).with(@name).returns(@node)
+ Puppet::Node.indirection.expects(:find).with(@name).returns(@node)
@compiler.expects(:compile).with(@node)
@compiler.find(@request)
end
@@ -92,37 +92,37 @@ describe Puppet::Resource::Catalog::Compiler do
it "should use the provided node name by default" do
@request.expects(:key).returns "my_node"
- Puppet::Node.expects(:find).with("my_node").returns @node
+ Puppet::Node.indirection.expects(:find).with("my_node").returns @node
@compiler.expects(:compile).with(@node)
@compiler.find(@request)
end
it "should fail if no node is passed and none can be found" do
- Puppet::Node.stubs(:find).with(@name).returns(nil)
+ Puppet::Node.indirection.stubs(:find).with(@name).returns(nil)
proc { @compiler.find(@request) }.should raise_error(ArgumentError)
end
it "should fail intelligently when searching for a node raises an exception" do
- Puppet::Node.stubs(:find).with(@name).raises "eh"
+ Puppet::Node.indirection.stubs(:find).with(@name).raises "eh"
proc { @compiler.find(@request) }.should raise_error(Puppet::Error)
end
it "should pass the found node to the compiler for compiling" do
- Puppet::Node.expects(:find).with(@name).returns(@node)
+ Puppet::Node.indirection.expects(:find).with(@name).returns(@node)
config = mock 'config'
Puppet::Parser::Compiler.expects(:compile).with(@node)
@compiler.find(@request)
end
it "should extract and save any facts from the request" do
- Puppet::Node.expects(:find).with(@name).returns @node
+ Puppet::Node.indirection.expects(:find).with(@name).returns @node
@compiler.expects(:extract_facts_from_request).with(@request)
Puppet::Parser::Compiler.stubs(:compile)
@compiler.find(@request)
end
it "should return the results of compiling as the catalog" do
- Puppet::Node.stubs(:find).returns(@node)
+ Puppet::Node.indirection.stubs(:find).returns(@node)
config = mock 'config'
result = mock 'result'
@@ -131,7 +131,7 @@ describe Puppet::Resource::Catalog::Compiler do
end
it "should benchmark the compile process" do
- Puppet::Node.stubs(:find).returns(@node)
+ Puppet::Node.indirection.stubs(:find).returns(@node)
@compiler.stubs(:networked?).returns(true)
@compiler.expects(:benchmark).with do |level, message|
level == :notice and message =~ /^Compiled catalog/
@@ -141,7 +141,7 @@ describe Puppet::Resource::Catalog::Compiler do
end
it "should log the benchmark result" do
- Puppet::Node.stubs(:find).returns(@node)
+ Puppet::Node.indirection.stubs(:find).returns(@node)
@compiler.stubs(:networked?).returns(true)
Puppet::Parser::Compiler.stubs(:compile)
@@ -162,7 +162,7 @@ describe Puppet::Resource::Catalog::Compiler do
end
it "should do nothing if no facts are provided" do
- Puppet::Node::Facts.expects(:convert_from).never
+ Puppet::Node::Facts.indirection.expects(:convert_from).never
@request.options[:facts] = nil
@compiler.extract_facts_from_request(@request)
@@ -212,7 +212,7 @@ describe Puppet::Resource::Catalog::Compiler do
it "should look node information up via the Node class with the provided key" do
@node.stubs :merge
- Puppet::Node.expects(:find).with(@name).returns(@node)
+ Puppet::Node.indirection.expects(:find).with(@name).returns(@node)
@compiler.find(@request)
end
end
@@ -227,7 +227,7 @@ describe Puppet::Resource::Catalog::Compiler do
@node = mock 'node'
@request = stub 'request', :key => @name, :options => {}
@compiler.stubs(:compile)
- Puppet::Node.stubs(:find).with(@name).returns(@node)
+ Puppet::Node.indirection.stubs(:find).with(@name).returns(@node)
end
it "should add the server's Puppet version to the node's parameters as 'serverversion'" do
diff --git a/spec/unit/indirector/node/ldap_spec.rb b/spec/unit/indirector/node/ldap_spec.rb
index 042e7bd54..95ec12c80 100755
--- a/spec/unit/indirector/node/ldap_spec.rb
+++ b/spec/unit/indirector/node/ldap_spec.rb
@@ -311,7 +311,7 @@ describe Puppet::Node::Ldap do
@options = {}
@request = stub 'request', :key => "foo", :options => @options
- Puppet::Node::Facts.stubs(:terminus_class).returns :yaml
+ Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml
end
it "should find all nodes if no arguments are provided" do
diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb
index fb21532ba..5aae5d00e 100755
--- a/spec/unit/indirector_spec.rb
+++ b/spec/unit/indirector_spec.rb
@@ -64,24 +64,6 @@ describe Puppet::Indirector, "when registering an indirection" do
end
end
-describe "Delegated Indirection Method", :shared => true do
- it "should delegate to the indirection" do
- @indirection.expects(@method)
- @thingie.send(@method, "me")
- end
-
- it "should pass all of the passed arguments directly to the indirection instance" do
- @indirection.expects(@method).with("me", :one => :two)
- @thingie.send(@method, "me", :one => :two)
- end
-
- it "should return the results of the delegation as its result" do
- request = mock 'request'
- @indirection.expects(@method).returns "yay"
- @thingie.send(@method, "me").should == "yay"
- end
-end
-
describe Puppet::Indirector, "when redirecting a model" do
before do
@thingie = Class.new do
@@ -98,26 +80,6 @@ describe Puppet::Indirector, "when redirecting a model" do
@thingie.ancestors.should be_include(Puppet::Indirector::Envelope)
end
- describe "when finding instances via the model" do
- before { @method = :find }
- it_should_behave_like "Delegated Indirection Method"
- end
-
- describe "when destroying instances via the model" do
- before { @method = :destroy }
- it_should_behave_like "Delegated Indirection Method"
- end
-
- describe "when searching for instances via the model" do
- before { @method = :search }
- it_should_behave_like "Delegated Indirection Method"
- end
-
- describe "when expiring instances via the model" do
- before { @method = :expire }
- it_should_behave_like "Delegated Indirection Method"
- end
-
# This is an instance method, so it behaves a bit differently.
describe "when saving instances via the model" do
before do
@@ -141,16 +103,6 @@ describe Puppet::Indirector, "when redirecting a model" do
end
end
- it "should give the model the ability to set the indirection terminus class" do
- @indirection.expects(:terminus_class=).with(:myterm)
- @thingie.terminus_class = :myterm
- end
-
- it "should give the model the ability to set the indirection cache class" do
- @indirection.expects(:cache_class=).with(:mycache)
- @thingie.cache_class = :mycache
- end
-
after do
@indirection.delete
end
diff --git a/spec/unit/network/http/webrick_spec.rb b/spec/unit/network/http/webrick_spec.rb
index 8e7c92b71..91a35435a 100755
--- a/spec/unit/network/http/webrick_spec.rb
+++ b/spec/unit/network/http/webrick_spec.rb
@@ -282,7 +282,7 @@ describe Puppet::Network::HTTP::WEBrick do
@cert = stub 'cert', :content => "mycert"
@host = stub 'host', :key => @key, :certificate => @cert, :name => "yay", :ssl_store => "mystore"
- Puppet::SSL::Certificate.stubs(:find).with('ca').returns @cert
+ Puppet::SSL::Certificate.indirection.stubs(:find).with('ca').returns @cert
Puppet::SSL::Host.stubs(:localhost).returns @host
end
@@ -299,7 +299,7 @@ describe Puppet::Network::HTTP::WEBrick do
end
it "should fail if no CA certificate can be found" do
- Puppet::SSL::Certificate.stubs(:find).with('ca').returns nil
+ Puppet::SSL::Certificate.indirection.stubs(:find).with('ca').returns nil
lambda { @server.setup_ssl }.should raise_error(Puppet::Error)
end
diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb
index cb2aa3dc7..7873b415d 100755
--- a/spec/unit/node/facts_spec.rb
+++ b/spec/unit/node/facts_spec.rb
@@ -76,12 +76,6 @@ describe Puppet::Node::Facts, "when indirecting" do
@facts = Puppet::Node::Facts.new("me", "one" => "two")
end
- it "should redirect to the specified fact store for retrieval" do
- Puppet::Node::Facts.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find)
- Puppet::Node::Facts.find(:my_facts)
- end
-
it "should redirect to the specified fact store for storage" do
Puppet::Node::Facts.stubs(:indirection).returns(@indirection)
@indirection.expects(:save)
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 36334ea05..725075cb3 100755
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -84,11 +84,11 @@ end
describe Puppet::Node, "when merging facts" do
before do
@node = Puppet::Node.new("testnode")
- Puppet::Node::Facts.stubs(:find).with(@node.name).returns(Puppet::Node::Facts.new(@node.name, "one" => "c", "two" => "b"))
+ Puppet::Node::Facts.indirection.stubs(:find).with(@node.name).returns(Puppet::Node::Facts.new(@node.name, "one" => "c", "two" => "b"))
end
it "should fail intelligently if it cannot find facts" do
- Puppet::Node::Facts.expects(:find).with(@node.name).raises "foo"
+ Puppet::Node::Facts.indirection.expects(:find).with(@node.name).raises "foo"
lambda { @node.fact_merge }.should raise_error(Puppet::Error)
end
@@ -128,13 +128,6 @@ describe Puppet::Node, "when merging facts" do
end
describe Puppet::Node, "when indirecting" do
- it "should redirect to the indirection" do
- @indirection = stub 'indirection', :name => :node
- Puppet::Node.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find)
- Puppet::Node.find(:my_node.to_s)
- end
-
it "should default to the 'plain' node terminus" do
Puppet::Node.indirection.terminus_class.should == :plain
end
diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb
index fbfe29ff3..672bb8ffc 100755
--- a/spec/unit/resource/catalog_spec.rb
+++ b/spec/unit/resource/catalog_spec.rb
@@ -818,12 +818,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
Puppet::Util::Cacher.expire
end
- it "should redirect to the indirection for retrieval" do
- Puppet::Resource::Catalog.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find)
- Puppet::Resource::Catalog.find(:myconfig)
- end
-
it "should use the value of the 'catalog_terminus' setting to determine its terminus class" do
# Puppet only checks the terminus setting the first time you ask
# so this returns the object to the clean state
diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb
index 39fee3f0a..2219aa99d 100755
--- a/spec/unit/ssl/certificate_authority_spec.rb
+++ b/spec/unit/ssl/certificate_authority_spec.rb
@@ -138,13 +138,13 @@ describe Puppet::SSL::CertificateAuthority do
it "should return any found CRL instance" do
crl = mock 'crl'
- Puppet::SSL::CertificateRevocationList.expects(:find).returns crl
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:find).returns crl
@ca.crl.should equal(crl)
end
it "should create, generate, and save a new CRL instance of no CRL can be found" do
crl = mock 'crl'
- Puppet::SSL::CertificateRevocationList.expects(:find).returns nil
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:find).returns nil
Puppet::SSL::CertificateRevocationList.expects(:new).returns crl
@@ -252,7 +252,7 @@ describe Puppet::SSL::CertificateAuthority do
@inventory = stub 'inventory', :add => nil
@ca.stubs(:inventory).returns @inventory
- Puppet::SSL::CertificateRequest.stubs(:destroy)
+ Puppet::SSL::CertificateRequest.indirection.stubs(:destroy)
end
describe "and calculating the next certificate serial number" do
@@ -295,7 +295,7 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should not look up a certificate request for the host" do
- Puppet::SSL::CertificateRequest.expects(:find).never
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).never
@ca.sign(@name, :ca, @request)
end
@@ -340,7 +340,7 @@ describe Puppet::SSL::CertificateAuthority do
@serial = 10
@ca.stubs(:next_serial).returns @serial
- Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request
+ Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
@cert.stubs :save
end
@@ -353,13 +353,13 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should use look up a CSR for the host in the :ca_file terminus" do
- Puppet::SSL::CertificateRequest.expects(:find).with(@name).returns @request
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with(@name).returns @request
@ca.sign(@name)
end
it "should fail if no CSR can be found for the host" do
- Puppet::SSL::CertificateRequest.expects(:find).with(@name).returns nil
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with(@name).returns nil
lambda { @ca.sign(@name) }.should raise_error(ArgumentError)
end
@@ -395,7 +395,7 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should remove the host's certificate request" do
- Puppet::SSL::CertificateRequest.expects(:destroy).with(@name)
+ Puppet::SSL::CertificateRequest.indirection.expects(:destroy).with(@name)
@ca.sign(@name)
end
@@ -405,7 +405,7 @@ describe Puppet::SSL::CertificateAuthority do
@serial = 10
@ca.stubs(:next_serial).returns @serial
- Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request
+ Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
@cert.stubs :save
Puppet::SSL::Certificate.expects(:new).with(@name).returns @cert
@@ -414,7 +414,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should return the certificate instance" do
@ca.stubs(:next_serial).returns @serial
- Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request
+ Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
@cert.stubs :save
@ca.sign(@name).should equal(@cert)
end
@@ -423,7 +423,7 @@ describe Puppet::SSL::CertificateAuthority do
@ca.stubs(:next_serial).returns @serial
@inventory.expects(:add).with(@cert)
- Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request
+ Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request
@cert.stubs :save
@ca.sign(@name)
end
@@ -436,7 +436,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should do nothing if autosign is disabled" do
Puppet.settings.expects(:value).with(:autosign).returns 'false'
- Puppet::SSL::CertificateRequest.expects(:search).never
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).never
@ca.autosign
end
@@ -444,7 +444,7 @@ describe Puppet::SSL::CertificateAuthority do
Puppet.settings.expects(:value).with(:autosign).returns '/auto/sign'
FileTest.expects(:exist?).with("/auto/sign").returns false
- Puppet::SSL::CertificateRequest.expects(:search).never
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).never
@ca.autosign
end
@@ -454,7 +454,7 @@ describe Puppet::SSL::CertificateAuthority do
FileTest.stubs(:exist?).with("/auto/sign").returns true
File.stubs(:readlines).with("/auto/sign").returns ["one\n", "two\n"]
- Puppet::SSL::CertificateRequest.stubs(:search).returns []
+ Puppet::SSL::CertificateRequest.indirection.stubs(:search).returns []
@store = stub 'store', :allow => nil
Puppet::Network::AuthStore.stubs(:new).returns @store
@@ -495,13 +495,13 @@ describe Puppet::SSL::CertificateAuthority do
it "should sign all CSRs whose hostname matches the autosign configuration" do
csr1 = mock 'csr1'
csr2 = mock 'csr2'
- Puppet::SSL::CertificateRequest.stubs(:search).returns [csr1, csr2]
+ Puppet::SSL::CertificateRequest.indirection.stubs(:search).returns [csr1, csr2]
end
it "should not sign CSRs whose hostname does not match the autosign configuration" do
csr1 = mock 'csr1'
csr2 = mock 'csr2'
- Puppet::SSL::CertificateRequest.stubs(:search).returns [csr1, csr2]
+ Puppet::SSL::CertificateRequest.indirection.stubs(:search).returns [csr1, csr2]
end
end
end
@@ -548,7 +548,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should be able to list waiting certificate requests" do
req1 = stub 'req1', :name => "one"
req2 = stub 'req2', :name => "two"
- Puppet::SSL::CertificateRequest.expects(:search).with("*").returns [req1, req2]
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).with("*").returns [req1, req2]
@ca.waiting?.should == %w{one two}
end
@@ -566,19 +566,19 @@ describe Puppet::SSL::CertificateAuthority do
it "should list certificates as the sorted list of all existing signed certificates" do
cert1 = stub 'cert1', :name => "cert1"
cert2 = stub 'cert2', :name => "cert2"
- Puppet::SSL::Certificate.expects(:search).with("*").returns [cert1, cert2]
+ Puppet::SSL::Certificate.indirection.expects(:search).with("*").returns [cert1, cert2]
@ca.list.should == %w{cert1 cert2}
end
describe "and printing certificates" do
it "should return nil if the certificate cannot be found" do
- Puppet::SSL::Certificate.expects(:find).with("myhost").returns nil
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil
@ca.print("myhost").should be_nil
end
it "should print certificates by calling :to_text on the host's certificate" do
cert1 = stub 'cert1', :name => "cert1", :to_text => "mytext"
- Puppet::SSL::Certificate.expects(:find).with("myhost").returns cert1
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns cert1
@ca.print("myhost").should == "mytext"
end
end
@@ -586,19 +586,19 @@ describe Puppet::SSL::CertificateAuthority do
describe "and fingerprinting certificates" do
before :each do
@cert = stub 'cert', :name => "cert", :fingerprint => "DIGEST"
- Puppet::SSL::Certificate.stubs(:find).with("myhost").returns @cert
- Puppet::SSL::CertificateRequest.stubs(:find).with("myhost")
+ Puppet::SSL::Certificate.indirection.stubs(:find).with("myhost").returns @cert
+ Puppet::SSL::CertificateRequest.indirection.stubs(:find).with("myhost")
end
it "should raise an error if the certificate or CSR cannot be found" do
- Puppet::SSL::Certificate.expects(:find).with("myhost").returns nil
- Puppet::SSL::CertificateRequest.expects(:find).with("myhost").returns nil
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myhost").returns nil
lambda { @ca.fingerprint("myhost") }.should raise_error
end
it "should try to find a CSR if no certificate can be found" do
- Puppet::SSL::Certificate.expects(:find).with("myhost").returns nil
- Puppet::SSL::CertificateRequest.expects(:find).with("myhost").returns @cert
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myhost").returns @cert
@cert.expects(:fingerprint)
@ca.fingerprint("myhost")
end
@@ -623,7 +623,7 @@ describe Puppet::SSL::CertificateAuthority do
Puppet.settings.stubs(:value).returns "crtstuff"
@cert = stub 'cert', :content => "mycert"
- Puppet::SSL::Certificate.stubs(:find).returns @cert
+ Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert
@crl = stub('crl', :content => "mycrl")
@@ -631,7 +631,7 @@ describe Puppet::SSL::CertificateAuthority do
end
it "should fail if the host's certificate cannot be found" do
- Puppet::SSL::Certificate.expects(:find).with("me").returns(nil)
+ Puppet::SSL::Certificate.indirection.expects(:find).with("me").returns(nil)
lambda { @ca.verify("me") }.should raise_error(ArgumentError)
end
@@ -694,7 +694,7 @@ describe Puppet::SSL::CertificateAuthority do
@real_cert = stub 'real_cert', :serial => 15
@cert = stub 'cert', :content => @real_cert
- Puppet::SSL::Certificate.stubs(:find).returns @cert
+ Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert
end
@@ -714,7 +714,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should get the serial number from the local certificate if it exists" do
@ca.crl.expects(:revoke).with { |serial, key| serial == 15 }
- Puppet::SSL::Certificate.expects(:find).with("host").returns @cert
+ Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns @cert
@ca.revoke('host')
end
@@ -722,7 +722,7 @@ describe Puppet::SSL::CertificateAuthority do
it "should get the serial number from inventory if no local certificate exists" do
real_cert = stub 'real_cert', :serial => 15
cert = stub 'cert', :content => real_cert
- Puppet::SSL::Certificate.expects(:find).with("host").returns nil
+ Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns nil
@ca.inventory.expects(:serial).with("host").returns 16
@@ -739,13 +739,13 @@ describe Puppet::SSL::CertificateAuthority do
before do
@host = stub 'host', :generate_certificate_request => nil
Puppet::SSL::Host.stubs(:new).returns @host
- Puppet::SSL::Certificate.stubs(:find).returns nil
+ Puppet::SSL::Certificate.indirection.stubs(:find).returns nil
@ca.stubs(:sign)
end
it "should fail if a certificate already exists for the host" do
- Puppet::SSL::Certificate.expects(:find).with("him").returns "something"
+ Puppet::SSL::Certificate.indirection.expects(:find).with("him").returns "something"
lambda { @ca.generate("him") }.should raise_error(ArgumentError)
end
diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb
index b2e43393c..3b7ed18e1 100755
--- a/spec/unit/ssl/host_spec.rb
+++ b/spec/unit/ssl/host_spec.rb
@@ -22,7 +22,7 @@ describe Puppet::SSL::Host do
it "should retrieve its public key from its private key" do
realkey = mock 'realkey'
key = stub 'key', :content => realkey
- Puppet::SSL::Key.stubs(:find).returns(key)
+ Puppet::SSL::Key.indirection.stubs(:find).returns(key)
pubkey = mock 'public_key'
realkey.expects(:public_key).returns pubkey
@@ -142,8 +142,8 @@ describe Puppet::SSL::Host do
describe "when specifying the CA location" do
before do
[Puppet::SSL::Key, Puppet::SSL::Certificate, Puppet::SSL::CertificateRequest, Puppet::SSL::CertificateRevocationList].each do |klass|
- klass.stubs(:terminus_class=)
- klass.stubs(:cache_class=)
+ klass.indirection.stubs(:terminus_class=)
+ klass.indirection.stubs(:cache_class=)
end
end
@@ -169,23 +169,23 @@ describe Puppet::SSL::Host do
describe "as 'local'" do
it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest as :file" do
- Puppet::SSL::Certificate.expects(:cache_class=).with :file
- Puppet::SSL::CertificateRequest.expects(:cache_class=).with :file
- Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with :file
+ Puppet::SSL::Certificate.indirection.expects(:cache_class=).with :file
+ Puppet::SSL::CertificateRequest.indirection.expects(:cache_class=).with :file
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:cache_class=).with :file
Puppet::SSL::Host.ca_location = :local
end
it "should set the terminus class for Key as :file" do
- Puppet::SSL::Key.expects(:terminus_class=).with :file
+ Puppet::SSL::Key.indirection.expects(:terminus_class=).with :file
Puppet::SSL::Host.ca_location = :local
end
it "should set the terminus class for Certificate, CertificateRevocationList, and CertificateRequest as :ca" do
- Puppet::SSL::Certificate.expects(:terminus_class=).with :ca
- Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :ca
- Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :ca
+ Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :ca
+ Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :ca
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :ca
Puppet::SSL::Host.ca_location = :local
end
@@ -193,23 +193,23 @@ describe Puppet::SSL::Host do
describe "as 'remote'" do
it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest as :file" do
- Puppet::SSL::Certificate.expects(:cache_class=).with :file
- Puppet::SSL::CertificateRequest.expects(:cache_class=).with :file
- Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with :file
+ Puppet::SSL::Certificate.indirection.expects(:cache_class=).with :file
+ Puppet::SSL::CertificateRequest.indirection.expects(:cache_class=).with :file
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:cache_class=).with :file
Puppet::SSL::Host.ca_location = :remote
end
it "should set the terminus class for Key as :file" do
- Puppet::SSL::Key.expects(:terminus_class=).with :file
+ Puppet::SSL::Key.indirection.expects(:terminus_class=).with :file
Puppet::SSL::Host.ca_location = :remote
end
it "should set the terminus class for Certificate, CertificateRevocationList, and CertificateRequest as :rest" do
- Puppet::SSL::Certificate.expects(:terminus_class=).with :rest
- Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :rest
- Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :rest
+ Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :rest
+ Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :rest
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :rest
Puppet::SSL::Host.ca_location = :remote
end
@@ -217,18 +217,18 @@ describe Puppet::SSL::Host do
describe "as 'only'" do
it "should set the terminus class for Key, Certificate, CertificateRevocationList, and CertificateRequest as :ca" do
- Puppet::SSL::Key.expects(:terminus_class=).with :ca
- Puppet::SSL::Certificate.expects(:terminus_class=).with :ca
- Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :ca
- Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :ca
+ Puppet::SSL::Key.indirection.expects(:terminus_class=).with :ca
+ Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :ca
+ Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :ca
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :ca
Puppet::SSL::Host.ca_location = :only
end
it "should reset the cache class for Certificate, CertificateRevocationList, and CertificateRequest to nil" do
- Puppet::SSL::Certificate.expects(:cache_class=).with nil
- Puppet::SSL::CertificateRequest.expects(:cache_class=).with nil
- Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with nil
+ Puppet::SSL::Certificate.indirection.expects(:cache_class=).with nil
+ Puppet::SSL::CertificateRequest.indirection.expects(:cache_class=).with nil
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:cache_class=).with nil
Puppet::SSL::Host.ca_location = :only
end
@@ -236,10 +236,10 @@ describe Puppet::SSL::Host do
describe "as 'none'" do
it "should set the terminus class for Key, Certificate, CertificateRevocationList, and CertificateRequest as :file" do
- Puppet::SSL::Key.expects(:terminus_class=).with :file
- Puppet::SSL::Certificate.expects(:terminus_class=).with :file
- Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :file
- Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :file
+ Puppet::SSL::Key.indirection.expects(:terminus_class=).with :file
+ Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :file
+ Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :file
+ Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :file
Puppet::SSL::Host.ca_location = :none
end
@@ -252,21 +252,21 @@ describe Puppet::SSL::Host do
describe "when destroying a host's SSL files" do
before do
- Puppet::SSL::Key.stubs(:destroy).returns false
- Puppet::SSL::Certificate.stubs(:destroy).returns false
- Puppet::SSL::CertificateRequest.stubs(:destroy).returns false
+ Puppet::SSL::Key.indirection.stubs(:destroy).returns false
+ Puppet::SSL::Certificate.indirection.stubs(:destroy).returns false
+ Puppet::SSL::CertificateRequest.indirection.stubs(:destroy).returns false
end
it "should destroy its certificate, certificate request, and key" do
- Puppet::SSL::Key.expects(:destroy).with("myhost")
- Puppet::SSL::Certificate.expects(:destroy).with("myhost")
- Puppet::SSL::CertificateRequest.expects(:destroy).with("myhost")
+ Puppet::SSL::Key.indirection.expects(:destroy).with("myhost")
+ Puppet::SSL::Certificate.indirection.expects(:destroy).with("myhost")
+ Puppet::SSL::CertificateRequest.indirection.expects(:destroy).with("myhost")
Puppet::SSL::Host.destroy("myhost")
end
it "should return true if any of the classes returned true" do
- Puppet::SSL::Certificate.expects(:destroy).with("myhost").returns true
+ Puppet::SSL::Certificate.indirection.expects(:destroy).with("myhost").returns true
Puppet::SSL::Host.destroy("myhost").should be_true
end
@@ -305,12 +305,12 @@ describe Puppet::SSL::Host do
end
it "should return nil if the key is not set and cannot be found" do
- Puppet::SSL::Key.expects(:find).with("myname").returns(nil)
+ Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(nil)
@host.key.should be_nil
end
it "should find the key in the Key class and return the Puppet instance" do
- Puppet::SSL::Key.expects(:find).with("myname").returns(@key)
+ Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(@key)
@host.key.should equal(@key)
end
@@ -335,7 +335,7 @@ describe Puppet::SSL::Host do
end
it "should return any previously found key without requerying" do
- Puppet::SSL::Key.expects(:find).with("myname").returns(@key).once
+ Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(@key).once
@host.key.should equal(@key)
@host.key.should equal(@key)
end
@@ -348,12 +348,12 @@ describe Puppet::SSL::Host do
end
it "should return nil if the key is not set and cannot be found" do
- Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns(nil)
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns(nil)
@host.certificate_request.should be_nil
end
it "should find the request in the Key class and return it and return the Puppet SSL request" do
- Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns @request
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns @request
@host.certificate_request.should equal(@request)
end
@@ -385,7 +385,7 @@ describe Puppet::SSL::Host do
end
it "should return any previously found request without requerying" do
- Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns(@request).once
+ Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns(@request).once
@host.certificate_request.should equal(@request)
@host.certificate_request.should equal(@request)
@@ -415,36 +415,36 @@ describe Puppet::SSL::Host do
end
it "should find the CA certificate if it does not have a certificate" do
- Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
- Puppet::SSL::Certificate.stubs(:find).with("myname").returns @cert
+ Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
+ Puppet::SSL::Certificate.indirection.stubs(:find).with("myname").returns @cert
@host.certificate
end
it "should not find the CA certificate if it is the CA host" do
@host.expects(:ca?).returns true
- Puppet::SSL::Certificate.stubs(:find)
- Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).never
+ Puppet::SSL::Certificate.indirection.stubs(:find)
+ Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).never
@host.certificate
end
it "should return nil if it cannot find a CA certificate" do
- Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns nil
- Puppet::SSL::Certificate.expects(:find).with("myname").never
+ Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns nil
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myname").never
@host.certificate.should be_nil
end
it "should find the key if it does not have one" do
- Puppet::SSL::Certificate.stubs(:find)
+ Puppet::SSL::Certificate.indirection.stubs(:find)
@host.expects(:key).returns mock("key")
@host.certificate
end
it "should generate the key if one cannot be found" do
- Puppet::SSL::Certificate.stubs(:find)
+ Puppet::SSL::Certificate.indirection.stubs(:find)
@host.expects(:key).returns nil
@host.expects(:generate_key)
@@ -453,8 +453,8 @@ describe Puppet::SSL::Host do
end
it "should find the certificate in the Certificate class and return the Puppet certificate instance" do
- Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
- Puppet::SSL::Certificate.expects(:find).with("myname").returns @cert
+ Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns @cert
@host.certificate.should equal(@cert)
end
@@ -462,14 +462,14 @@ describe Puppet::SSL::Host do
it "should fail if the found certificate does not match the private key" do
@host.expects(:certificate_matches_key?).returns false
- Puppet::SSL::Certificate.stubs(:find).returns @cert
+ Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert
lambda { @host.certificate }.should raise_error(Puppet::Error)
end
it "should return any previously found certificate" do
- Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
- Puppet::SSL::Certificate.expects(:find).with("myname").returns(@cert).once
+ Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
+ Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns(@cert).once
@host.certificate.should equal(@cert)
@host.certificate.should equal(@cert)
@@ -482,30 +482,30 @@ describe Puppet::SSL::Host do
describe "when listing certificate hosts" do
it "should default to listing all clients with any file types" do
- Puppet::SSL::Key.expects(:search).returns []
- Puppet::SSL::Certificate.expects(:search).returns []
- Puppet::SSL::CertificateRequest.expects(:search).returns []
+ Puppet::SSL::Key.indirection.expects(:search).returns []
+ Puppet::SSL::Certificate.indirection.expects(:search).returns []
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).returns []
Puppet::SSL::Host.search
end
it "should be able to list only clients with a key" do
- Puppet::SSL::Key.expects(:search).returns []
- Puppet::SSL::Certificate.expects(:search).never
- Puppet::SSL::CertificateRequest.expects(:search).never
+ Puppet::SSL::Key.indirection.expects(:search).returns []
+ Puppet::SSL::Certificate.indirection.expects(:search).never
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).never
Puppet::SSL::Host.search :for => Puppet::SSL::Key
end
it "should be able to list only clients with a certificate" do
- Puppet::SSL::Key.expects(:search).never
- Puppet::SSL::Certificate.expects(:search).returns []
- Puppet::SSL::CertificateRequest.expects(:search).never
+ Puppet::SSL::Key.indirection.expects(:search).never
+ Puppet::SSL::Certificate.indirection.expects(:search).returns []
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).never
Puppet::SSL::Host.search :for => Puppet::SSL::Certificate
end
it "should be able to list only clients with a certificate request" do
- Puppet::SSL::Key.expects(:search).never
- Puppet::SSL::Certificate.expects(:search).never
- Puppet::SSL::CertificateRequest.expects(:search).returns []
+ Puppet::SSL::Key.indirection.expects(:search).never
+ Puppet::SSL::Certificate.indirection.expects(:search).never
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).returns []
Puppet::SSL::Host.search :for => Puppet::SSL::CertificateRequest
end
@@ -514,9 +514,9 @@ describe Puppet::SSL::Host do
cert = stub 'cert', :name => "cert"
csr = stub 'csr', :name => "csr"
- Puppet::SSL::Key.expects(:search).returns [key]
- Puppet::SSL::Certificate.expects(:search).returns [cert]
- Puppet::SSL::CertificateRequest.expects(:search).returns [csr]
+ Puppet::SSL::Key.indirection.expects(:search).returns [key]
+ Puppet::SSL::Certificate.indirection.expects(:search).returns [cert]
+ Puppet::SSL::CertificateRequest.indirection.expects(:search).returns [csr]
returned = []
%w{key cert csr}.each do |name|
@@ -606,7 +606,7 @@ describe Puppet::SSL::Host do
Puppet.settings.stubs(:value).with(:localcacert).returns "ssl_host_testing"
- Puppet::SSL::CertificateRevocationList.stubs(:find).returns(nil)
+ Puppet::SSL::CertificateRevocationList.indirection.stubs(:find).returns(nil)
end
it "should accept a purpose" do
@@ -628,7 +628,7 @@ describe Puppet::SSL::Host do
describe "and a CRL is available" do
before do
@crl = stub 'crl', :content => "real_crl"
- Puppet::SSL::CertificateRevocationList.stubs(:find).returns @crl
+ Puppet::SSL::CertificateRevocationList.indirection.stubs(:find).returns @crl
Puppet.settings.stubs(:value).with(:certificate_revocation).returns true
end
diff --git a/spec/unit/ssl/inventory_spec.rb b/spec/unit/ssl/inventory_spec.rb
index a57d6fafc..008fece0b 100755
--- a/spec/unit/ssl/inventory_spec.rb
+++ b/spec/unit/ssl/inventory_spec.rb
@@ -40,7 +40,7 @@ describe Puppet::SSL::Inventory do
Puppet.settings.stubs(:write)
FileTest.stubs(:exist?).with("/inven/tory").returns false
- Puppet::SSL::Certificate.stubs(:search).returns []
+ Puppet::SSL::Certificate.indirection.stubs(:search).returns []
end
it "should log that it is building a new inventory file" do
@@ -67,7 +67,7 @@ describe Puppet::SSL::Inventory do
cert1 = mock 'cert1'
cert2 = mock 'cert2'
- Puppet::SSL::Certificate.expects(:search).with("*").returns [cert1, cert2]
+ Puppet::SSL::Certificate.indirection.expects(:search).with("*").returns [cert1, cert2]
@class.any_instance.expects(:add).with(cert1)
@class.any_instance.expects(:add).with(cert2)
diff --git a/spec/unit/status_spec.rb b/spec/unit/status_spec.rb
index 71bfa4a44..938bbdf84 100644
--- a/spec/unit/status_spec.rb
+++ b/spec/unit/status_spec.rb
@@ -4,8 +4,8 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe Puppet::Status do
it "should implement find" do
- Puppet::Status.find( :default ).should be_is_a(Puppet::Status)
- Puppet::Status.find( :default ).status["is_alive"].should == true
+ Puppet::Status.indirection.find( :default ).should be_is_a(Puppet::Status)
+ Puppet::Status.indirection.find( :default ).status["is_alive"].should == true
end
it "should default to is_alive is true" do
diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb
index b310713d2..4dd104c74 100755
--- a/spec/unit/transaction/report_spec.rb
+++ b/spec/unit/transaction/report_spec.rb
@@ -53,13 +53,6 @@ describe Puppet::Transaction::Report do
end
describe "when using the indirector" do
- it "should redirect :find to the indirection" do
- @indirection = stub 'indirection', :name => :report
- Puppet::Transaction::Report.stubs(:indirection).returns(@indirection)
- @indirection.expects(:find)
- Puppet::Transaction::Report.find(:report)
- end
-
it "should redirect :save to the indirection" do
Facter.stubs(:value).returns("eh")
@indirection = stub 'indirection', :name => :report
diff --git a/spec/unit/type/file/source_spec.rb b/spec/unit/type/file/source_spec.rb
index a45a1f74e..b6833f77c 100755
--- a/spec/unit/type/file/source_spec.rb
+++ b/spec/unit/type/file/source_spec.rb
@@ -54,22 +54,22 @@ describe Puppet::Type.type(:file).attrclass(:source) do
it "should collect its metadata using the Metadata class if it is not already set" do
@source = source.new(:resource => @resource, :value => "/foo/bar")
- Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns @metadata
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns @metadata
@source.metadata
end
it "should use the metadata from the first found source" do
metadata = stub 'metadata', :source= => nil
@source = source.new(:resource => @resource, :value => ["/foo/bar", "/fee/booz"])
- Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns nil
- Puppet::FileServing::Metadata.expects(:find).with("/fee/booz").returns metadata
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns nil
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/fee/booz").returns metadata
@source.metadata.should equal(metadata)
end
it "should store the found source as the metadata's source" do
metadata = mock 'metadata'
@source = source.new(:resource => @resource, :value => "/foo/bar")
- Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns metadata
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns metadata
metadata.expects(:source=).with("/foo/bar")
@source.metadata
@@ -77,7 +77,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
it "should fail intelligently if an exception is encountered while querying for metadata" do
@source = source.new(:resource => @resource, :value => "/foo/bar")
- Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").raises RuntimeError
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").raises RuntimeError
@source.expects(:fail).raises ArgumentError
lambda { @source.metadata }.should raise_error(ArgumentError)
@@ -85,7 +85,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
it "should fail if no specified sources can be found" do
@source = source.new(:resource => @resource, :value => "/foo/bar")
- Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns nil
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns nil
@source.expects(:fail).raises RuntimeError
@@ -96,7 +96,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
expirer = stub 'expired', :dependent_data_expired? => true
metadata = stub 'metadata', :source= => nil
- Puppet::FileServing::Metadata.expects(:find).with("/fee/booz").returns metadata
+ Puppet::FileServing::Metadata.indirection.expects(:find).with("/fee/booz").returns metadata
@source = source.new(:resource => @resource, :value => ["/fee/booz"])
@source.metadata = "foo"
diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb
index 7d93dfd64..943a3c38a 100755
--- a/spec/unit/type/file_spec.rb
+++ b/spec/unit/type/file_spec.rb
@@ -510,47 +510,47 @@ describe Puppet::Type.type(:file) do
describe "when executing a recursive search" do
it "should use Metadata to do its recursion" do
- Puppet::FileServing::Metadata.expects(:search)
+ Puppet::FileServing::Metadata.indirection.expects(:search)
@file.perform_recursion(@file[:path])
end
it "should use the provided path as the key to the search" do
- Puppet::FileServing::Metadata.expects(:search).with { |key, options| key == "/foo" }
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| key == "/foo" }
@file.perform_recursion("/foo")
end
it "should return the results of the metadata search" do
- Puppet::FileServing::Metadata.expects(:search).returns "foobar"
+ Puppet::FileServing::Metadata.indirection.expects(:search).returns "foobar"
@file.perform_recursion(@file[:path]).should == "foobar"
end
it "should pass its recursion value to the search" do
@file[:recurse] = true
- Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:recurse] == true }
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurse] == true }
@file.perform_recursion(@file[:path])
end
it "should pass true if recursion is remote" do
@file[:recurse] = :remote
- Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:recurse] == true }
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurse] == true }
@file.perform_recursion(@file[:path])
end
it "should pass its recursion limit value to the search" do
@file[:recurselimit] = 10
- Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:recurselimit] == 10 }
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurselimit] == 10 }
@file.perform_recursion(@file[:path])
end
it "should configure the search to ignore or manage links" do
@file[:links] = :manage
- Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:links] == :manage }
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:links] == :manage }
@file.perform_recursion(@file[:path])
end
it "should pass its 'ignore' setting to the search if it has one" do
@file[:ignore] = %w{.svn CVS}
- Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:ignore] == %w{.svn CVS} }
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:ignore] == %w{.svn CVS} }
@file.perform_recursion(@file[:path])
end
end
@@ -597,7 +597,7 @@ describe Puppet::Type.type(:file) do
it "should set checksum_type to none if this file checksum is none" do
@file[:checksum] = :none
- Puppet::FileServing::Metadata.expects(:search).with { |path,params| params[:checksum_type] == :none }.returns [@metadata]
+ Puppet::FileServing::Metadata.indirection.expects(:search).with { |path,params| params[:checksum_type] == :none }.returns [@metadata]
@file.expects(:newchild).with("my/file").returns "fiebar"
@file.recurse_local
end
diff --git a/test/language/parser.rb b/test/language/parser.rb
index 6f3d751c2..93d4ae693 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -500,9 +500,9 @@ file { "/tmp/yayness":
ensure
if Puppet.features.rails?
Puppet[:storeconfigs] = false
- Puppet::Resource::Catalog.cache_class = catalog_cache_class
- Puppet::Node::Facts.cache_class = facts_cache_class
- Puppet::Node.cache_class = node_cache_class
+ Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class
+ Puppet::Node::Facts.indirection.cache_class = facts_cache_class
+ Puppet::Node.indirection.cache_class = node_cache_class
end
end
@@ -539,9 +539,9 @@ file { "/tmp/yayness":
ensure
if Puppet.features.rails?
Puppet[:storeconfigs] = false
- Puppet::Resource::Catalog.cache_class = catalog_cache_class
- Puppet::Node::Facts.cache_class = facts_cache_class
- Puppet::Node.cache_class = node_cache_class
+ Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class
+ Puppet::Node::Facts.indirection.cache_class = facts_cache_class
+ Puppet::Node.indirection.cache_class = node_cache_class
end
end
diff --git a/test/language/scope.rb b/test/language/scope.rb
index d9c122a92..15c321166 100755
--- a/test/language/scope.rb
+++ b/test/language/scope.rb
@@ -233,9 +233,9 @@ Host <<||>>"
}
ensure
Puppet[:storeconfigs] = false
- Puppet::Resource::Catalog.cache_class = catalog_cache_class
- Puppet::Node::Facts.cache_class = facts_cache_class
- Puppet::Node.cache_class = node_cache_class
+ Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class
+ Puppet::Node::Facts.indirection.cache_class = facts_cache_class
+ Puppet::Node.indirection.cache_class = node_cache_class
end
else
$stderr.puts "No ActiveRecord -- skipping collection tests"
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 51c5e23fe..e5b513a46 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -501,7 +501,7 @@ class TestSnippets < Test::Unit::TestCase
catalog = nil
assert_nothing_raised("Could not compile catalog") {
- catalog = Puppet::Resource::Catalog.find(node)
+ catalog = Puppet::Resource::Catalog.indirection.find(node)
}
assert_nothing_raised("Could not convert catalog") {
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb
index 81869ac06..018f6904b 100755
--- a/test/network/handler/master.rb
+++ b/test/network/handler/master.rb
@@ -13,7 +13,7 @@ class TestMaster < Test::Unit::TestCase
@master = Puppet::Network::Handler.master.new(:Manifest => tempfile)
@catalog = stub 'catalog', :extract => ""
- Puppet::Resource::Catalog.stubs(:find).returns(@catalog)
+ Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog)
end
def teardown
@@ -53,7 +53,7 @@ class TestMaster < Test::Unit::TestCase
@master.stubs(:decode_facts)
- Puppet::Resource::Catalog.expects(:find).with("foo.com").returns(@catalog)
+ Puppet::Resource::Catalog.indirection.expects(:find).with("foo.com").returns(@catalog)
@master.getconfig("facts", "yaml", "foo.com")
end
@@ -68,7 +68,7 @@ class TestMasterFormats < Test::Unit::TestCase
@master.stubs(:decode_facts)
@catalog = stub 'catalog', :extract => ""
- Puppet::Resource::Catalog.stubs(:find).returns(@catalog)
+ Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog)
end
def test_marshal_can_be_used