puppet 0.25.4 → 0.25.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +679 -23
- data/LICENSE +2 -2
- data/README +2 -2
- data/README.queueing +1 -1
- data/README.rst +2 -2
- data/Rakefile +4 -2
- data/bin/filebucket +2 -2
- data/bin/pi +1 -1
- data/bin/puppet +2 -2
- data/bin/puppetca +2 -2
- data/bin/puppetd +5 -4
- data/bin/puppetdoc +4 -4
- data/bin/puppetmasterd +2 -2
- data/bin/puppetqd +2 -2
- data/bin/puppetrun +2 -2
- data/bin/ralsh +2 -2
- data/conf/epm.list +2 -2
- data/conf/gentoo/puppet/puppet.conf +0 -4
- data/conf/osx/PackageInfo.plist +1 -1
- data/conf/redhat/logrotate +1 -0
- data/conf/redhat/puppet.conf +0 -4
- data/conf/redhat/puppet.spec +16 -10
- data/conf/solaris/pkginfo +2 -2
- data/conf/solaris/smf/puppetd.xml +3 -3
- data/conf/solaris/smf/puppetmasterd.xml +3 -3
- data/conf/solaris/smf/svc-puppetd +1 -1
- data/conf/solaris/smf/svc-puppetmasterd +1 -1
- data/conf/suse/puppet.spec +16 -14
- data/conf/suse/puppet.suse.patch +16 -0
- data/examples/etc/puppet/fileserver.conf +5 -5
- data/examples/modules/sample-module/README.txt +3 -3
- data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +1 -1
- data/ext/extlookup.rb +1 -1
- data/ext/nagios/check_puppet.rb +1 -1
- data/ext/nagios/naggen +2 -2
- data/ext/puppet-test +2 -2
- data/ext/puppetlast +1 -1
- data/ext/puppetstoredconfigclean.rb +1 -1
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/vim/syntax/puppet.vim +5 -3
- data/install.rb +11 -9
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/puppetd.rb +5 -4
- data/lib/puppet/configurer.rb +38 -31
- data/lib/puppet/defaults.rb +18 -13
- data/lib/puppet/file_serving/fileset.rb +2 -2
- data/lib/puppet/file_serving/terminus_helper.rb +1 -0
- data/lib/puppet/indirector/indirection.rb +20 -13
- data/lib/puppet/network/authstore.rb +3 -3
- data/lib/puppet/network/format_handler.rb +1 -1
- data/lib/puppet/network/handler/fileserver.rb +2 -2
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/http_pool.rb +0 -2
- data/lib/puppet/network/http_server/webrick.rb +1 -1
- data/lib/puppet/parser/ast/casestatement.rb +4 -4
- data/lib/puppet/parser/ast/ifstatement.rb +2 -1
- data/lib/puppet/parser/ast/leaf.rb +1 -0
- data/lib/puppet/parser/ast/selector.rb +2 -3
- data/lib/puppet/parser/functions/generate.rb +3 -5
- data/lib/puppet/parser/functions/require.rb +8 -1
- data/lib/puppet/parser/functions/template.rb +1 -1
- data/lib/puppet/parser/lexer.rb +1 -7
- data/lib/puppet/parser/resource.rb +10 -4
- data/lib/puppet/parser/scope.rb +61 -9
- data/lib/puppet/provider/augeas/augeas.rb +23 -7
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/maillist/mailman.rb +2 -2
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/service/debian.rb +2 -2
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/smf.rb +4 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +9 -29
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/reference/providers.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -0
- data/lib/puppet/resource/catalog.rb +1 -8
- data/lib/puppet/simple_graph.rb +37 -12
- data/lib/puppet/ssl/certificate.rb +2 -3
- data/lib/puppet/ssl/certificate_authority.rb +1 -1
- data/lib/puppet/ssl/host.rb +19 -12
- data/lib/puppet/sslcertificates/ca.rb +5 -6
- data/lib/puppet/transaction.rb +11 -15
- data/lib/puppet/type/augeas.rb +2 -1
- data/lib/puppet/type/exec.rb +1 -1
- data/lib/puppet/type/file.rb +9 -2
- data/lib/puppet/type/file/checksum.rb +2 -1
- data/lib/puppet/type/file/source.rb +4 -4
- data/lib/puppet/type/maillist.rb +10 -0
- data/lib/puppet/type/mount.rb +5 -3
- data/lib/puppet/type/tidy.rb +36 -30
- data/lib/puppet/util/autoload.rb +2 -2
- data/lib/puppet/util/checksums.rb +5 -0
- data/lib/puppet/util/monkey_patches.rb +38 -0
- data/lib/puppet/util/nagios_maker.rb +1 -1
- data/lib/puppet/util/settings.rb +14 -4
- data/lib/puppet/util/suidmanager.rb +26 -2
- data/lib/puppet/util/zaml.rb +318 -0
- data/man/{man8/puppet.conf.8 → man5/puppet.conf.5} +594 -899
- data/man/man8/filebucket.8 +31 -45
- data/man/man8/pi.8 +16 -22
- data/man/man8/puppet.8 +26 -36
- data/man/man8/puppetca.8 +38 -51
- data/man/man8/puppetd.8 +48 -64
- data/man/man8/puppetdoc.8 +37 -48
- data/man/man8/puppetmasterd.8 +24 -32
- data/man/man8/puppetqd.8 +22 -27
- data/man/man8/puppetrun.8 +46 -58
- data/man/man8/ralsh.8 +43 -48
- data/spec/integration/bin/puppetmasterd.rb +20 -9
- data/spec/integration/defaults.rb +4 -0
- data/spec/integration/indirector/certificate/rest.rb +0 -1
- data/spec/integration/indirector/certificate_request/rest.rb +0 -1
- data/spec/integration/indirector/certificate_revocation_list/rest.rb +0 -1
- data/spec/integration/indirector/report/rest.rb +0 -1
- data/spec/integration/indirector/rest.rb +0 -1
- data/spec/integration/parser/functions/require.rb +18 -1
- data/spec/unit/application/filebucket.rb +2 -2
- data/spec/unit/application/puppetd.rb +4 -5
- data/spec/unit/configurer.rb +46 -8
- data/spec/unit/file_serving/fileset.rb +6 -0
- data/spec/unit/file_serving/terminus_helper.rb +10 -0
- data/spec/unit/indirector/indirection.rb +17 -28
- data/spec/unit/network/format_handler.rb +3 -2
- data/spec/unit/network/http_pool.rb +9 -17
- data/spec/unit/parser/ast/casestatement.rb +4 -12
- data/spec/unit/parser/ast/ifstatement.rb +2 -1
- data/spec/unit/parser/ast/leaf.rb +15 -2
- data/spec/unit/parser/ast/selector.rb +4 -12
- data/spec/unit/parser/functions/generate.rb +41 -0
- data/spec/unit/parser/functions/require.rb +23 -2
- data/spec/unit/parser/resource.rb +18 -0
- data/spec/unit/parser/scope.rb +94 -3
- data/spec/unit/provider/augeas/augeas.rb +27 -3
- data/spec/unit/provider/ssh_authorized_key/parsed.rb +30 -19
- data/spec/unit/resource/catalog.rb +16 -39
- data/spec/unit/simple_graph.rb +14 -0
- data/spec/unit/ssl/host.rb +55 -17
- data/spec/unit/type/file.rb +43 -11
- data/spec/unit/type/file/checksum.rb +28 -0
- data/spec/unit/type/tidy.rb +30 -1
- data/spec/unit/util/autoload.rb +2 -1
- data/spec/unit/util/checksums.rb +7 -1
- data/spec/unit/util/settings.rb +39 -2
- data/spec/unit/util/zaml.rb +38 -0
- data/tasks/rake/changelog.rake +1 -1
- data/tasks/rake/gem.rake +3 -3
- data/tasks/rake/git_workflow.rake +1 -1
- data/tasks/rake/sign.rake +1 -1
- data/tasks/rake/yard.rake +11 -0
- data/test/certmgr/certmgr.rb +1 -1
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -1
- data/test/lib/puppettest/support/utils.rb +2 -1
- data/test/network/handler/ca.rb +4 -4
- data/test/network/handler/fileserver.rb +15 -9
- data/test/other/transactions.rb +1 -6
- data/test/puppet/tc_suidmanager.rb +7 -2
- data/test/ral/providers/host/parsed.rb +6 -6
- data/test/ral/providers/package.rb +4 -0
- data/test/ral/providers/sshkey/parsed.rb +5 -5
- data/test/ral/type/file.rb +0 -21
- data/test/ral/type/host.rb +4 -4
- data/test/ral/type/resources.rb +0 -78
- data/test/ral/type/sshkey.rb +2 -2
- data/test/test +1 -1
- data/test/util/settings.rb +6 -6
- metadata +1065 -1050
- data/test/executables/puppetmodule.rb +0 -55
- data/test/ral/providers/service/debian.rb +0 -58
@@ -16,6 +16,10 @@ describe "puppetmasterd" do
|
|
16
16
|
Puppet[:certdnsnames] = "localhost"
|
17
17
|
|
18
18
|
@@port = 12345
|
19
|
+
|
20
|
+
Puppet::SSL::Host.instance_eval{
|
21
|
+
@value_cache = {}
|
22
|
+
}
|
19
23
|
end
|
20
24
|
|
21
25
|
after {
|
@@ -48,7 +52,7 @@ describe "puppetmasterd" do
|
|
48
52
|
f.puts { "notify { testing: }" }
|
49
53
|
end
|
50
54
|
|
51
|
-
args = arguments + addl_args
|
55
|
+
args = arguments + " " + addl_args
|
52
56
|
|
53
57
|
bin = File.join(File.dirname(__FILE__), "..", "..", "..", "sbin", "puppetmasterd")
|
54
58
|
lib = File.join(File.dirname(__FILE__), "..", "..", "..", "lib")
|
@@ -56,9 +60,22 @@ describe "puppetmasterd" do
|
|
56
60
|
end
|
57
61
|
|
58
62
|
def stop
|
59
|
-
if @pidfile and
|
63
|
+
if @pidfile and File.exist?(@pidfile)
|
60
64
|
pid = File.read(@pidfile).chomp.to_i
|
61
65
|
Process.kill(:TERM, pid)
|
66
|
+
10.times do
|
67
|
+
break unless File.exist?(@pidfile)
|
68
|
+
sleep 1
|
69
|
+
end
|
70
|
+
begin
|
71
|
+
# sigkill and report if process was still running
|
72
|
+
Process.kill(:KILL, pid)
|
73
|
+
|
74
|
+
raise "Process didn't die from SIGTERM after 10 seconds"
|
75
|
+
rescue Errno::ESRCH
|
76
|
+
# process wasn't running. good.
|
77
|
+
end
|
78
|
+
|
62
79
|
end
|
63
80
|
end
|
64
81
|
|
@@ -73,16 +90,10 @@ describe "puppetmasterd" do
|
|
73
90
|
it "should be serving status information over xmlrpc" do
|
74
91
|
start
|
75
92
|
|
76
|
-
sleep
|
93
|
+
sleep 6
|
77
94
|
|
78
95
|
client = Puppet::Network::Client.status.new(:Server => "localhost", :Port => @@port)
|
79
96
|
|
80
|
-
FileUtils.mkdir_p(File.dirname(Puppet[:autosign]))
|
81
|
-
File.open(Puppet[:autosign], "w") { |f|
|
82
|
-
f.puts Puppet[:certname]
|
83
|
-
}
|
84
|
-
|
85
|
-
client.cert
|
86
97
|
retval = client.status
|
87
98
|
|
88
99
|
retval.should == 1
|
@@ -223,4 +223,8 @@ describe "Puppet defaults" do
|
|
223
223
|
it "should have a 'postrun_command' that defaults to the empty string" do
|
224
224
|
Puppet.settings[:postrun_command].should == ""
|
225
225
|
end
|
226
|
+
|
227
|
+
it "should have a 'certificate_revocation' setting that defaults to true" do
|
228
|
+
Puppet.settings[:certificate_revocation].should be_true
|
229
|
+
end
|
226
230
|
end
|
@@ -21,7 +21,6 @@ describe "Certificate Request REST Terminus" do
|
|
21
21
|
Puppet.settings[:vardir] = @dir
|
22
22
|
Puppet.settings[:server] = "127.0.0.1"
|
23
23
|
Puppet.settings[:masterport] = "34343"
|
24
|
-
Puppet.settings[:http_enable_post_connection_check] = false
|
25
24
|
|
26
25
|
Puppet[:servertype] = 'webrick'
|
27
26
|
Puppet[:server] = '127.0.0.1'
|
@@ -40,7 +40,6 @@ describe Puppet::Indirector::REST do
|
|
40
40
|
Puppet.settings[:vardir] = @dir
|
41
41
|
Puppet.settings[:server] = "127.0.0.1"
|
42
42
|
Puppet.settings[:masterport] = "34343"
|
43
|
-
Puppet.settings[:http_enable_post_connection_check] = false
|
44
43
|
|
45
44
|
Puppet::SSL::Host.ca_location = :local
|
46
45
|
|
@@ -22,10 +22,27 @@ describe "the require function" do
|
|
22
22
|
|
23
23
|
@scope.function_require("requiredclass")
|
24
24
|
@scope.resource["require"].should_not be_nil
|
25
|
-
ref = @scope.resource["require"]
|
25
|
+
ref = @scope.resource["require"].shift
|
26
26
|
ref.type.should == "Class"
|
27
27
|
ref.title.should == "requiredclass"
|
28
28
|
end
|
29
|
+
|
30
|
+
it "should queue relationships between the 'required' class and our classes" do
|
31
|
+
@parser.newclass("requiredclass1")
|
32
|
+
@parser.newclass("requiredclass2")
|
33
|
+
|
34
|
+
@scope.function_require("requiredclass1")
|
35
|
+
@scope.function_require("requiredclass2")
|
36
|
+
|
37
|
+
@scope.resource["require"].should_not be_nil
|
38
|
+
|
39
|
+
(ref1,ref2) = @scope.resource["require"]
|
40
|
+
ref1.type.should == "Class"
|
41
|
+
ref1.title.should == "requiredclass1"
|
42
|
+
ref2.type.should == "Class"
|
43
|
+
ref2.title.should == "requiredclass2"
|
44
|
+
end
|
45
|
+
|
29
46
|
end
|
30
47
|
|
31
48
|
describe "the include function" do
|
@@ -124,9 +124,9 @@ describe "Filebucket" do
|
|
124
124
|
describe "with remote bucket" do
|
125
125
|
|
126
126
|
it "should create a remote Client to the configured server" do
|
127
|
-
Puppet.stubs(:[]).with(:server).returns("puppet.
|
127
|
+
Puppet.stubs(:[]).with(:server).returns("puppet.puppetlabs.com")
|
128
128
|
|
129
|
-
Puppet::Network::Client::Dipper.expects(:new).with { |h| h[:Server] == "puppet.
|
129
|
+
Puppet::Network::Client::Dipper.expects(:new).with { |h| h[:Server] == "puppet.puppetlabs.com" }
|
130
130
|
|
131
131
|
@filebucket.run_setup
|
132
132
|
end
|
@@ -275,10 +275,10 @@ describe "puppetd" do
|
|
275
275
|
|
276
276
|
it "should set a central log destination with --centrallogs" do
|
277
277
|
@puppetd.options.stubs(:[]).with(:centrallogs).returns(true)
|
278
|
-
Puppet.stubs(:[]).with(:server).returns("puppet.
|
278
|
+
Puppet.stubs(:[]).with(:server).returns("puppet.puppetlabs.com")
|
279
279
|
Puppet::Util::Log.stubs(:newdestination).with(:syslog)
|
280
280
|
|
281
|
-
Puppet::Util::Log.expects(:newdestination).with("puppet.
|
281
|
+
Puppet::Util::Log.expects(:newdestination).with("puppet.puppetlabs.com")
|
282
282
|
|
283
283
|
@puppetd.run_setup
|
284
284
|
end
|
@@ -301,9 +301,8 @@ describe "puppetd" do
|
|
301
301
|
@puppetd.run_setup
|
302
302
|
end
|
303
303
|
|
304
|
-
it "should
|
305
|
-
Puppet
|
306
|
-
|
304
|
+
it "should change the catalog_terminus setting to 'rest'" do
|
305
|
+
Puppet.expects(:[]=).with(:catalog_terminus, :rest)
|
307
306
|
@puppetd.run_setup
|
308
307
|
end
|
309
308
|
|
data/spec/unit/configurer.rb
CHANGED
@@ -141,9 +141,54 @@ describe Puppet::Configurer, "when retrieving a catalog" do
|
|
141
141
|
|
142
142
|
@catalog = Puppet::Resource::Catalog.new
|
143
143
|
|
144
|
+
# this is the default when using a Configurer instance
|
145
|
+
Puppet::Resource::Catalog.indirection.stubs(:terminus_class).returns :rest
|
146
|
+
|
144
147
|
@agent.stubs(:convert_catalog).returns @catalog
|
145
148
|
end
|
146
149
|
|
150
|
+
describe "and configured to only retrieve a catalog from the cache" do
|
151
|
+
before do
|
152
|
+
Puppet.settings[:use_cached_catalog] = true
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should first look in the cache for a catalog" do
|
156
|
+
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
|
157
|
+
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.never
|
158
|
+
|
159
|
+
@agent.retrieve_catalog.should == @catalog
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should compile a new catalog if none is found in the cache" do
|
163
|
+
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
|
164
|
+
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
|
165
|
+
|
166
|
+
@agent.retrieve_catalog.should == @catalog
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "when not using a REST terminus for catalogs" do
|
171
|
+
it "should not pass any facts when retrieving the catalog" do
|
172
|
+
@agent.expects(:facts_for_uploading).never
|
173
|
+
Puppet::Resource::Catalog.expects(:find).with { |name, options|
|
174
|
+
options[:facts].nil?
|
175
|
+
}.returns @catalog
|
176
|
+
|
177
|
+
@agent.retrieve_catalog
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
describe "when using a REST terminus for catalogs" do
|
182
|
+
it "should pass the prepared facts and the facts format as arguments when retrieving the catalog" do
|
183
|
+
@agent.expects(:facts_for_uploading).returns(:facts => "myfacts", :facts_format => :foo)
|
184
|
+
Puppet::Resource::Catalog.expects(:find).with { |name, options|
|
185
|
+
options[:facts] == "myfacts" and options[:facts_format] == :foo
|
186
|
+
}.returns @catalog
|
187
|
+
|
188
|
+
@agent.retrieve_catalog
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
147
192
|
it "should use the Catalog class to get its catalog" do
|
148
193
|
Puppet::Resource::Catalog.expects(:find).returns @catalog
|
149
194
|
|
@@ -152,19 +197,12 @@ describe Puppet::Configurer, "when retrieving a catalog" do
|
|
152
197
|
|
153
198
|
it "should use its certname to retrieve the catalog" do
|
154
199
|
Facter.stubs(:value).returns "eh"
|
155
|
-
Puppet.
|
200
|
+
Puppet.settings[:certname] = "myhost.domain.com"
|
156
201
|
Puppet::Resource::Catalog.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog
|
157
202
|
|
158
203
|
@agent.retrieve_catalog
|
159
204
|
end
|
160
205
|
|
161
|
-
it "should pass the prepared facts and the facts format as arguments when retrieving the catalog" do
|
162
|
-
@agent.expects(:facts_for_uploading).returns(:facts => "myfacts", :facts_format => :foo)
|
163
|
-
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:facts] == "myfacts" and options[:facts_format] == :foo }.returns @catalog
|
164
|
-
|
165
|
-
@agent.retrieve_catalog
|
166
|
-
end
|
167
|
-
|
168
206
|
it "should default to returning a catalog retrieved directly from the server, skipping the cache" do
|
169
207
|
Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
|
170
208
|
|
@@ -42,6 +42,12 @@ describe Puppet::FileServing::Fileset, " when initializing" do
|
|
42
42
|
set.links.should == :manage
|
43
43
|
end
|
44
44
|
|
45
|
+
it "should accept a 'checksum_type' option" do
|
46
|
+
File.expects(:lstat).with("/some/file").returns stub("stat")
|
47
|
+
set = Puppet::FileServing::Fileset.new("/some/file", :checksum_type => :test)
|
48
|
+
set.checksum_type.should == :test
|
49
|
+
end
|
50
|
+
|
45
51
|
it "should fail if 'links' is set to anything other than :manage or :follow" do
|
46
52
|
proc { Puppet::FileServing::Fileset.new("/some/file", :links => :whatever) }.should raise_error(ArgumentError)
|
47
53
|
end
|
@@ -76,6 +76,16 @@ describe Puppet::FileServing::TerminusHelper do
|
|
76
76
|
@helper.path2instances(@request, "/my/file")
|
77
77
|
end
|
78
78
|
|
79
|
+
it "should set the request checksum_type if one is provided" do
|
80
|
+
@one.expects(:checksum_type=).with :test
|
81
|
+
@two.expects(:checksum_type=).with :test
|
82
|
+
@model.expects(:new).returns(@one)
|
83
|
+
@model.expects(:new).returns(@two)
|
84
|
+
|
85
|
+
@request.options[:checksum_type] = :test
|
86
|
+
@helper.path2instances(@request, "/my/file")
|
87
|
+
end
|
88
|
+
|
79
89
|
it "should collect the instance's attributes" do
|
80
90
|
@one.expects(:collect)
|
81
91
|
@two.expects(:collect)
|
@@ -545,44 +545,33 @@ describe Puppet::Indirector::Indirection do
|
|
545
545
|
@indirection.expire("/my/key")
|
546
546
|
end
|
547
547
|
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
@cache.expects(:destroy).with { |r| r.method == :destroy and r.key == "/my/key" }
|
552
|
-
@cache.expects(:save).never
|
553
|
-
@indirection.expire("/my/key")
|
554
|
-
end
|
555
|
-
end
|
556
|
-
|
557
|
-
describe "and the terminus does not support removal of cache items with destroy" do
|
558
|
-
it "should set the cached instance's expiration to a time in the past" do
|
559
|
-
@cache.expects(:find).returns @cached
|
560
|
-
@cache.stubs(:save)
|
548
|
+
it "should set the cached instance's expiration to a time in the past" do
|
549
|
+
@cache.expects(:find).returns @cached
|
550
|
+
@cache.stubs(:save)
|
561
551
|
|
562
|
-
|
552
|
+
@cached.expects(:expiration=).with { |t| t < Time.now }
|
563
553
|
|
564
|
-
|
565
|
-
|
554
|
+
@indirection.expire("/my/key")
|
555
|
+
end
|
566
556
|
|
567
|
-
|
568
|
-
|
557
|
+
it "should save the now expired instance back into the cache" do
|
558
|
+
@cache.expects(:find).returns @cached
|
569
559
|
|
570
|
-
|
560
|
+
@cached.expects(:expiration=).with { |t| t < Time.now }
|
571
561
|
|
572
|
-
|
562
|
+
@cache.expects(:save)
|
573
563
|
|
574
|
-
|
575
|
-
|
564
|
+
@indirection.expire("/my/key")
|
565
|
+
end
|
576
566
|
|
577
|
-
|
578
|
-
|
567
|
+
it "should use a request to save the expired resource to the cache" do
|
568
|
+
@cache.expects(:find).returns @cached
|
579
569
|
|
580
|
-
|
570
|
+
@cached.expects(:expiration=).with { |t| t < Time.now }
|
581
571
|
|
582
|
-
|
572
|
+
@cache.expects(:save).with { |r| r.is_a?(Puppet::Indirector::Request) and r.instance == @cached and r.method == :save }.returns(@cached)
|
583
573
|
|
584
|
-
|
585
|
-
end
|
574
|
+
@indirection.expire("/my/key")
|
586
575
|
end
|
587
576
|
end
|
588
577
|
end
|
@@ -73,8 +73,9 @@ describe Puppet::Network::FormatHandler do
|
|
73
73
|
it "should still return the default format first" do
|
74
74
|
FormatTester.supported_formats.should == [:two, :one]
|
75
75
|
end
|
76
|
-
it "should log a
|
77
|
-
Puppet.expects(:
|
76
|
+
it "should log a debug message" do
|
77
|
+
Puppet.expects(:debug).with("Value of 'preferred_serialization_format' (unsupported) is invalid for FormatTester, using default (two)")
|
78
|
+
Puppet.expects(:debug).with("FormatTester supports formats: one two; using two")
|
78
79
|
FormatTester.supported_formats
|
79
80
|
end
|
80
81
|
end
|
@@ -36,7 +36,7 @@ describe Puppet::Network::HttpPool do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should return an http instance created with the passed host and port" do
|
39
|
-
http = stub 'http', :use_ssl= => nil, :read_timeout= => nil, :open_timeout= => nil, :
|
39
|
+
http = stub 'http', :use_ssl= => nil, :read_timeout= => nil, :open_timeout= => nil, :started? => false
|
40
40
|
Net::HTTP.expects(:new).with("me", 54321, nil, nil).returns(http)
|
41
41
|
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(http)
|
42
42
|
end
|
@@ -53,16 +53,8 @@ describe Puppet::Network::HttpPool do
|
|
53
53
|
Puppet::Network::HttpPool.http_instance("me", 54321).open_timeout.should == 120
|
54
54
|
end
|
55
55
|
|
56
|
-
it "should default to http_enable_post_connection_check being enabled" do
|
57
|
-
Puppet.settings[:http_enable_post_connection_check].should be_true
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should set enable_post_connection_check true " do
|
61
|
-
Puppet::Network::HttpPool.http_instance("me", 54321).instance_variable_get("@enable_post_connection_check").should be(Puppet.settings[:http_enable_post_connection_check])
|
62
|
-
end
|
63
|
-
|
64
56
|
it "should create the http instance with the proxy host and port set if the http_proxy is not set to 'none'" do
|
65
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
57
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
66
58
|
Puppet::Network::HttpPool.http_instance("me", 54321).open_timeout.should == 120
|
67
59
|
end
|
68
60
|
|
@@ -72,19 +64,19 @@ describe Puppet::Network::HttpPool do
|
|
72
64
|
end
|
73
65
|
|
74
66
|
it "should cache http instances" do
|
75
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
67
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
76
68
|
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
77
69
|
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
|
78
70
|
end
|
79
71
|
|
80
72
|
it "should have a mechanism for getting a new http instance instead of the cached instance" do
|
81
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
73
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
82
74
|
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
83
75
|
Puppet::Network::HttpPool.http_instance("me", 54321, true).should_not equal(old)
|
84
76
|
end
|
85
77
|
|
86
78
|
it "should close existing, open connections when requesting a new connection" do
|
87
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
79
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
88
80
|
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
89
81
|
old.expects(:started?).returns(true)
|
90
82
|
old.expects(:finish)
|
@@ -92,7 +84,7 @@ describe Puppet::Network::HttpPool do
|
|
92
84
|
end
|
93
85
|
|
94
86
|
it "should have a mechanism for clearing the http cache" do
|
95
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
87
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
96
88
|
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
97
89
|
Puppet::Network::HttpPool.http_instance("me", 54321).should equal(old)
|
98
90
|
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
@@ -101,7 +93,7 @@ describe Puppet::Network::HttpPool do
|
|
101
93
|
end
|
102
94
|
|
103
95
|
it "should close open http connections when clearing the cache" do
|
104
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
96
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
105
97
|
one = Puppet::Network::HttpPool.http_instance("me", 54321)
|
106
98
|
one.expects(:started?).returns(true)
|
107
99
|
one.expects(:finish).returns(true)
|
@@ -109,7 +101,7 @@ describe Puppet::Network::HttpPool do
|
|
109
101
|
end
|
110
102
|
|
111
103
|
it "should not close unopened http connections when clearing the cache" do
|
112
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
104
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
113
105
|
one = Puppet::Network::HttpPool.http_instance("me", 54321)
|
114
106
|
one.expects(:started?).returns(false)
|
115
107
|
one.expects(:finish).never
|
@@ -123,7 +115,7 @@ describe Puppet::Network::HttpPool do
|
|
123
115
|
end
|
124
116
|
|
125
117
|
it "should not cache http instances" do
|
126
|
-
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
118
|
+
stub_settings :http_proxy_host => "myhost", :http_proxy_port => 432, :configtimeout => 120
|
127
119
|
old = Puppet::Network::HttpPool.http_instance("me", 54321)
|
128
120
|
Puppet::Network::HttpPool.http_instance("me", 54321).should_not equal(old)
|
129
121
|
end
|