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.

Files changed (169) hide show
  1. data/CHANGELOG +679 -23
  2. data/LICENSE +2 -2
  3. data/README +2 -2
  4. data/README.queueing +1 -1
  5. data/README.rst +2 -2
  6. data/Rakefile +4 -2
  7. data/bin/filebucket +2 -2
  8. data/bin/pi +1 -1
  9. data/bin/puppet +2 -2
  10. data/bin/puppetca +2 -2
  11. data/bin/puppetd +5 -4
  12. data/bin/puppetdoc +4 -4
  13. data/bin/puppetmasterd +2 -2
  14. data/bin/puppetqd +2 -2
  15. data/bin/puppetrun +2 -2
  16. data/bin/ralsh +2 -2
  17. data/conf/epm.list +2 -2
  18. data/conf/gentoo/puppet/puppet.conf +0 -4
  19. data/conf/osx/PackageInfo.plist +1 -1
  20. data/conf/redhat/logrotate +1 -0
  21. data/conf/redhat/puppet.conf +0 -4
  22. data/conf/redhat/puppet.spec +16 -10
  23. data/conf/solaris/pkginfo +2 -2
  24. data/conf/solaris/smf/puppetd.xml +3 -3
  25. data/conf/solaris/smf/puppetmasterd.xml +3 -3
  26. data/conf/solaris/smf/svc-puppetd +1 -1
  27. data/conf/solaris/smf/svc-puppetmasterd +1 -1
  28. data/conf/suse/puppet.spec +16 -14
  29. data/conf/suse/puppet.suse.patch +16 -0
  30. data/examples/etc/puppet/fileserver.conf +5 -5
  31. data/examples/modules/sample-module/README.txt +3 -3
  32. data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +1 -1
  33. data/ext/extlookup.rb +1 -1
  34. data/ext/nagios/check_puppet.rb +1 -1
  35. data/ext/nagios/naggen +2 -2
  36. data/ext/puppet-test +2 -2
  37. data/ext/puppetlast +1 -1
  38. data/ext/puppetstoredconfigclean.rb +1 -1
  39. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  40. data/ext/vim/syntax/puppet.vim +5 -3
  41. data/install.rb +11 -9
  42. data/lib/puppet.rb +1 -1
  43. data/lib/puppet/application/puppetd.rb +5 -4
  44. data/lib/puppet/configurer.rb +38 -31
  45. data/lib/puppet/defaults.rb +18 -13
  46. data/lib/puppet/file_serving/fileset.rb +2 -2
  47. data/lib/puppet/file_serving/terminus_helper.rb +1 -0
  48. data/lib/puppet/indirector/indirection.rb +20 -13
  49. data/lib/puppet/network/authstore.rb +3 -3
  50. data/lib/puppet/network/format_handler.rb +1 -1
  51. data/lib/puppet/network/handler/fileserver.rb +2 -2
  52. data/lib/puppet/network/handler/master.rb +1 -1
  53. data/lib/puppet/network/http_pool.rb +0 -2
  54. data/lib/puppet/network/http_server/webrick.rb +1 -1
  55. data/lib/puppet/parser/ast/casestatement.rb +4 -4
  56. data/lib/puppet/parser/ast/ifstatement.rb +2 -1
  57. data/lib/puppet/parser/ast/leaf.rb +1 -0
  58. data/lib/puppet/parser/ast/selector.rb +2 -3
  59. data/lib/puppet/parser/functions/generate.rb +3 -5
  60. data/lib/puppet/parser/functions/require.rb +8 -1
  61. data/lib/puppet/parser/functions/template.rb +1 -1
  62. data/lib/puppet/parser/lexer.rb +1 -7
  63. data/lib/puppet/parser/resource.rb +10 -4
  64. data/lib/puppet/parser/scope.rb +61 -9
  65. data/lib/puppet/provider/augeas/augeas.rb +23 -7
  66. data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
  67. data/lib/puppet/provider/maillist/mailman.rb +2 -2
  68. data/lib/puppet/provider/package/portage.rb +2 -2
  69. data/lib/puppet/provider/service/debian.rb +2 -2
  70. data/lib/puppet/provider/service/redhat.rb +1 -1
  71. data/lib/puppet/provider/service/smf.rb +4 -1
  72. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +9 -29
  73. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  74. data/lib/puppet/reference/configuration.rb +1 -1
  75. data/lib/puppet/reference/providers.rb +1 -1
  76. data/lib/puppet/reports/tagmail.rb +1 -0
  77. data/lib/puppet/resource/catalog.rb +1 -8
  78. data/lib/puppet/simple_graph.rb +37 -12
  79. data/lib/puppet/ssl/certificate.rb +2 -3
  80. data/lib/puppet/ssl/certificate_authority.rb +1 -1
  81. data/lib/puppet/ssl/host.rb +19 -12
  82. data/lib/puppet/sslcertificates/ca.rb +5 -6
  83. data/lib/puppet/transaction.rb +11 -15
  84. data/lib/puppet/type/augeas.rb +2 -1
  85. data/lib/puppet/type/exec.rb +1 -1
  86. data/lib/puppet/type/file.rb +9 -2
  87. data/lib/puppet/type/file/checksum.rb +2 -1
  88. data/lib/puppet/type/file/source.rb +4 -4
  89. data/lib/puppet/type/maillist.rb +10 -0
  90. data/lib/puppet/type/mount.rb +5 -3
  91. data/lib/puppet/type/tidy.rb +36 -30
  92. data/lib/puppet/util/autoload.rb +2 -2
  93. data/lib/puppet/util/checksums.rb +5 -0
  94. data/lib/puppet/util/monkey_patches.rb +38 -0
  95. data/lib/puppet/util/nagios_maker.rb +1 -1
  96. data/lib/puppet/util/settings.rb +14 -4
  97. data/lib/puppet/util/suidmanager.rb +26 -2
  98. data/lib/puppet/util/zaml.rb +318 -0
  99. data/man/{man8/puppet.conf.8 → man5/puppet.conf.5} +594 -899
  100. data/man/man8/filebucket.8 +31 -45
  101. data/man/man8/pi.8 +16 -22
  102. data/man/man8/puppet.8 +26 -36
  103. data/man/man8/puppetca.8 +38 -51
  104. data/man/man8/puppetd.8 +48 -64
  105. data/man/man8/puppetdoc.8 +37 -48
  106. data/man/man8/puppetmasterd.8 +24 -32
  107. data/man/man8/puppetqd.8 +22 -27
  108. data/man/man8/puppetrun.8 +46 -58
  109. data/man/man8/ralsh.8 +43 -48
  110. data/spec/integration/bin/puppetmasterd.rb +20 -9
  111. data/spec/integration/defaults.rb +4 -0
  112. data/spec/integration/indirector/certificate/rest.rb +0 -1
  113. data/spec/integration/indirector/certificate_request/rest.rb +0 -1
  114. data/spec/integration/indirector/certificate_revocation_list/rest.rb +0 -1
  115. data/spec/integration/indirector/report/rest.rb +0 -1
  116. data/spec/integration/indirector/rest.rb +0 -1
  117. data/spec/integration/parser/functions/require.rb +18 -1
  118. data/spec/unit/application/filebucket.rb +2 -2
  119. data/spec/unit/application/puppetd.rb +4 -5
  120. data/spec/unit/configurer.rb +46 -8
  121. data/spec/unit/file_serving/fileset.rb +6 -0
  122. data/spec/unit/file_serving/terminus_helper.rb +10 -0
  123. data/spec/unit/indirector/indirection.rb +17 -28
  124. data/spec/unit/network/format_handler.rb +3 -2
  125. data/spec/unit/network/http_pool.rb +9 -17
  126. data/spec/unit/parser/ast/casestatement.rb +4 -12
  127. data/spec/unit/parser/ast/ifstatement.rb +2 -1
  128. data/spec/unit/parser/ast/leaf.rb +15 -2
  129. data/spec/unit/parser/ast/selector.rb +4 -12
  130. data/spec/unit/parser/functions/generate.rb +41 -0
  131. data/spec/unit/parser/functions/require.rb +23 -2
  132. data/spec/unit/parser/resource.rb +18 -0
  133. data/spec/unit/parser/scope.rb +94 -3
  134. data/spec/unit/provider/augeas/augeas.rb +27 -3
  135. data/spec/unit/provider/ssh_authorized_key/parsed.rb +30 -19
  136. data/spec/unit/resource/catalog.rb +16 -39
  137. data/spec/unit/simple_graph.rb +14 -0
  138. data/spec/unit/ssl/host.rb +55 -17
  139. data/spec/unit/type/file.rb +43 -11
  140. data/spec/unit/type/file/checksum.rb +28 -0
  141. data/spec/unit/type/tidy.rb +30 -1
  142. data/spec/unit/util/autoload.rb +2 -1
  143. data/spec/unit/util/checksums.rb +7 -1
  144. data/spec/unit/util/settings.rb +39 -2
  145. data/spec/unit/util/zaml.rb +38 -0
  146. data/tasks/rake/changelog.rake +1 -1
  147. data/tasks/rake/gem.rake +3 -3
  148. data/tasks/rake/git_workflow.rake +1 -1
  149. data/tasks/rake/sign.rake +1 -1
  150. data/tasks/rake/yard.rake +11 -0
  151. data/test/certmgr/certmgr.rb +1 -1
  152. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -1
  153. data/test/lib/puppettest/support/utils.rb +2 -1
  154. data/test/network/handler/ca.rb +4 -4
  155. data/test/network/handler/fileserver.rb +15 -9
  156. data/test/other/transactions.rb +1 -6
  157. data/test/puppet/tc_suidmanager.rb +7 -2
  158. data/test/ral/providers/host/parsed.rb +6 -6
  159. data/test/ral/providers/package.rb +4 -0
  160. data/test/ral/providers/sshkey/parsed.rb +5 -5
  161. data/test/ral/type/file.rb +0 -21
  162. data/test/ral/type/host.rb +4 -4
  163. data/test/ral/type/resources.rb +0 -78
  164. data/test/ral/type/sshkey.rb +2 -2
  165. data/test/test +1 -1
  166. data/test/util/settings.rb +6 -6
  167. metadata +1065 -1050
  168. data/test/executables/puppetmodule.rb +0 -55
  169. 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 FileTest.exist?(@pidfile)
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 5
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
@@ -19,7 +19,6 @@ describe "Certificate REST Terminus" do
19
19
  Puppet.settings[:vardir] = @dir
20
20
  Puppet.settings[:server] = "127.0.0.1"
21
21
  Puppet.settings[:masterport] = "34343"
22
- Puppet.settings[:http_enable_post_connection_check] = false
23
22
 
24
23
  Puppet::Util::Cacher.expire
25
24
 
@@ -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'
@@ -19,7 +19,6 @@ describe "Certificate REST Terminus" do
19
19
  Puppet.settings[:vardir] = @dir
20
20
  Puppet.settings[:server] = "127.0.0.1"
21
21
  Puppet.settings[:masterport] = "34343"
22
- Puppet.settings[:http_enable_post_connection_check] = false
23
22
 
24
23
  Puppet::Util::Cacher.expire
25
24
 
@@ -19,7 +19,6 @@ describe "Report REST Terminus" do
19
19
  Puppet.settings[:vardir] = @dir
20
20
  Puppet.settings[:server] = "127.0.0.1"
21
21
  Puppet.settings[:masterport] = "34343"
22
- Puppet.settings[:http_enable_post_connection_check] = false
23
22
 
24
23
  Puppet::Util::Cacher.expire
25
24
 
@@ -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.reductivelabs.com")
127
+ Puppet.stubs(:[]).with(:server).returns("puppet.puppetlabs.com")
128
128
 
129
- Puppet::Network::Client::Dipper.expects(:new).with { |h| h[:Server] == "puppet.reductivelabs.com" }
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.reductivelabs.com")
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.reductivelabs.com")
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 tell the catalog handler to use REST" do
305
- Puppet::Resource::Catalog.expects(:terminus_class=).with(:rest)
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
 
@@ -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.expects(:[]).with(:certname).returns "myhost.domain.com"
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
- describe "and the terminus supports removal of cache items with destroy" do
549
- it "should destroy the cached instance" do
550
- @cache.expects(:find).returns @cached
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
- @cached.expects(:expiration=).with { |t| t < Time.now }
552
+ @cached.expects(:expiration=).with { |t| t < Time.now }
563
553
 
564
- @indirection.expire("/my/key")
565
- end
554
+ @indirection.expire("/my/key")
555
+ end
566
556
 
567
- it "should save the now expired instance back into the cache" do
568
- @cache.expects(:find).returns @cached
557
+ it "should save the now expired instance back into the cache" do
558
+ @cache.expects(:find).returns @cached
569
559
 
570
- @cached.expects(:expiration=).with { |t| t < Time.now }
560
+ @cached.expects(:expiration=).with { |t| t < Time.now }
571
561
 
572
- @cache.expects(:save)
562
+ @cache.expects(:save)
573
563
 
574
- @indirection.expire("/my/key")
575
- end
564
+ @indirection.expire("/my/key")
565
+ end
576
566
 
577
- it "should use a request to save the expired resource to the cache" do
578
- @cache.expects(:find).returns @cached
567
+ it "should use a request to save the expired resource to the cache" do
568
+ @cache.expects(:find).returns @cached
579
569
 
580
- @cached.expects(:expiration=).with { |t| t < Time.now }
570
+ @cached.expects(:expiration=).with { |t| t < Time.now }
581
571
 
582
- @cache.expects(:save).with { |r| r.is_a?(Puppet::Indirector::Request) and r.instance == @cached and r.method == :save }.returns(@cached)
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
- @indirection.expire("/my/key")
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 warning" do
77
- Puppet.expects(:warning)
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, :enable_post_connection_check= => nil, :started? => false
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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, :http_enable_post_connection_check => true
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