puppet 6.6.0-x86-mingw32 → 6.7.0-x86-mingw32

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 (254) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/ext/solaris/smf/puppet.xml +2 -0
  4. data/ext/yaml_nodes.rb +7 -7
  5. data/lib/hiera_puppet.rb +2 -1
  6. data/lib/puppet/application/apply.rb +2 -3
  7. data/lib/puppet/application/doc.rb +2 -1
  8. data/lib/puppet/application/face_base.rb +22 -15
  9. data/lib/puppet/application/script.rb +4 -6
  10. data/lib/puppet/configurer.rb +10 -5
  11. data/lib/puppet/confine_collection.rb +2 -1
  12. data/lib/puppet/daemon.rb +3 -2
  13. data/lib/puppet/defaults.rb +8 -0
  14. data/lib/puppet/environments.rb +9 -7
  15. data/lib/puppet/etc.rb +1 -1
  16. data/lib/puppet/external/pson/pure/parser.rb +2 -1
  17. data/lib/puppet/face/epp.rb +4 -2
  18. data/lib/puppet/face/help.rb +3 -2
  19. data/lib/puppet/face/module/changes.rb +2 -1
  20. data/lib/puppet/file_bucket/dipper.rb +2 -1
  21. data/lib/puppet/file_serving/configuration.rb +2 -1
  22. data/lib/puppet/file_serving/fileset.rb +1 -1
  23. data/lib/puppet/file_serving/http_metadata.rb +4 -2
  24. data/lib/puppet/file_serving/metadata.rb +2 -1
  25. data/lib/puppet/file_serving/mount/file.rb +2 -1
  26. data/lib/puppet/file_serving/mount/locales.rb +2 -1
  27. data/lib/puppet/file_serving/mount/modules.rb +4 -2
  28. data/lib/puppet/file_serving/mount/pluginfacts.rb +2 -1
  29. data/lib/puppet/file_serving/mount/plugins.rb +2 -1
  30. data/lib/puppet/file_serving/mount/tasks.rb +4 -2
  31. data/lib/puppet/file_system/uniquefile.rb +4 -2
  32. data/lib/puppet/functions/match.rb +2 -3
  33. data/lib/puppet/generate/type.rb +2 -1
  34. data/lib/puppet/graph/relationship_graph.rb +2 -1
  35. data/lib/puppet/graph/simple_graph.rb +3 -2
  36. data/lib/puppet/indirector/catalog/compiler.rb +16 -8
  37. data/lib/puppet/indirector/certificate/rest.rb +2 -1
  38. data/lib/puppet/indirector/face.rb +2 -2
  39. data/lib/puppet/indirector/file_server.rb +4 -2
  40. data/lib/puppet/indirector/indirection.rb +12 -6
  41. data/lib/puppet/indirector/node/exec.rb +2 -1
  42. data/lib/puppet/indirector/report/processor.rb +2 -1
  43. data/lib/puppet/indirector/request.rb +9 -5
  44. data/lib/puppet/indirector/ssl_file.rb +10 -8
  45. data/lib/puppet/indirector/terminus.rb +6 -3
  46. data/lib/puppet/info_service.rb +9 -0
  47. data/lib/puppet/info_service/plan_information_service.rb +36 -0
  48. data/lib/puppet/interface.rb +2 -1
  49. data/lib/puppet/interface/action.rb +10 -5
  50. data/lib/puppet/interface/action_manager.rb +2 -1
  51. data/lib/puppet/interface/documentation.rb +10 -7
  52. data/lib/puppet/interface/face_collection.rb +6 -3
  53. data/lib/puppet/interface/option.rb +4 -2
  54. data/lib/puppet/interface/option_manager.rb +4 -2
  55. data/lib/puppet/module.rb +35 -1
  56. data/lib/puppet/module/plan.rb +160 -0
  57. data/lib/puppet/module_tool.rb +2 -1
  58. data/lib/puppet/module_tool/applications/application.rb +2 -1
  59. data/lib/puppet/module_tool/applications/installer.rb +4 -2
  60. data/lib/puppet/module_tool/applications/upgrader.rb +4 -2
  61. data/lib/puppet/module_tool/contents_description.rb +2 -1
  62. data/lib/puppet/module_tool/metadata.rb +2 -3
  63. data/lib/puppet/module_tool/shared_behaviors.rb +2 -1
  64. data/lib/puppet/network/authconfig.rb +4 -2
  65. data/lib/puppet/network/authstore.rb +2 -1
  66. data/lib/puppet/network/formats.rb +2 -1
  67. data/lib/puppet/network/http/api/indirected_routes.rb +6 -4
  68. data/lib/puppet/network/http/handler.rb +2 -1
  69. data/lib/puppet/network/http/request.rb +2 -1
  70. data/lib/puppet/network/http/route.rb +2 -1
  71. data/lib/puppet/network/resolver.rb +3 -2
  72. data/lib/puppet/network/rights.rb +2 -1
  73. data/lib/puppet/node.rb +8 -4
  74. data/lib/puppet/pal/catalog_compiler.rb +8 -1
  75. data/lib/puppet/pal/compiler.rb +2 -1
  76. data/lib/puppet/pal/pal_impl.rb +8 -0
  77. data/lib/puppet/pal/script_compiler.rb +4 -2
  78. data/lib/puppet/parameter.rb +4 -2
  79. data/lib/puppet/parameter/value_collection.rb +8 -8
  80. data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
  81. data/lib/puppet/parser/compiler.rb +10 -5
  82. data/lib/puppet/parser/files.rb +2 -1
  83. data/lib/puppet/parser/functions.rb +2 -1
  84. data/lib/puppet/parser/relationship.rb +2 -1
  85. data/lib/puppet/parser/resource.rb +6 -3
  86. data/lib/puppet/parser/scope.rb +6 -4
  87. data/lib/puppet/parser/templatewrapper.rb +2 -1
  88. data/lib/puppet/parser/type_loader.rb +2 -1
  89. data/lib/puppet/pops/adaptable.rb +2 -5
  90. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +2 -1
  91. data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +2 -1
  92. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
  93. data/lib/puppet/pops/evaluator/runtime3_support.rb +8 -4
  94. data/lib/puppet/pops/loader/base_loader.rb +4 -2
  95. data/lib/puppet/pops/loader/dependency_loader.rb +4 -2
  96. data/lib/puppet/pops/loader/gem_support.rb +4 -2
  97. data/lib/puppet/pops/loader/loader.rb +4 -2
  98. data/lib/puppet/pops/loader/loader_paths.rb +2 -1
  99. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  100. data/lib/puppet/pops/lookup/interpolation.rb +2 -1
  101. data/lib/puppet/pops/model/factory.rb +4 -2
  102. data/lib/puppet/pops/parser/epp_support.rb +2 -1
  103. data/lib/puppet/pops/parser/heredoc_support.rb +2 -1
  104. data/lib/puppet/pops/parser/interpolation_support.rb +10 -5
  105. data/lib/puppet/pops/parser/lexer2.rb +6 -3
  106. data/lib/puppet/pops/parser/locator.rb +2 -1
  107. data/lib/puppet/pops/types/type_calculator.rb +1 -1
  108. data/lib/puppet/pops/types/type_parser.rb +4 -2
  109. data/lib/puppet/pops/validation.rb +2 -1
  110. data/lib/puppet/pops/validation/checker4_0.rb +6 -3
  111. data/lib/puppet/pops/visitor.rb +12 -6
  112. data/lib/puppet/property.rb +19 -16
  113. data/lib/puppet/property/ensure.rb +2 -1
  114. data/lib/puppet/property/keyvalue.rb +2 -1
  115. data/lib/puppet/property/list.rb +2 -1
  116. data/lib/puppet/provider.rb +10 -8
  117. data/lib/puppet/provider/exec.rb +7 -4
  118. data/lib/puppet/provider/file/posix.rb +6 -3
  119. data/lib/puppet/provider/group/groupadd.rb +2 -1
  120. data/lib/puppet/provider/group/ldap.rb +7 -4
  121. data/lib/puppet/provider/group/pw.rb +4 -2
  122. data/lib/puppet/provider/ldap.rb +8 -4
  123. data/lib/puppet/provider/nameservice.rb +8 -5
  124. data/lib/puppet/provider/nameservice/directoryservice.rb +8 -4
  125. data/lib/puppet/provider/network_device.rb +4 -2
  126. data/lib/puppet/provider/package.rb +2 -1
  127. data/lib/puppet/provider/package/aix.rb +4 -2
  128. data/lib/puppet/provider/package/appdmg.rb +4 -2
  129. data/lib/puppet/provider/package/apple.rb +2 -1
  130. data/lib/puppet/provider/package/apt.rb +4 -2
  131. data/lib/puppet/provider/package/blastwave.rb +2 -1
  132. data/lib/puppet/provider/package/dpkg.rb +6 -3
  133. data/lib/puppet/provider/package/fink.rb +2 -1
  134. data/lib/puppet/provider/package/gem.rb +4 -2
  135. data/lib/puppet/provider/package/macports.rb +6 -3
  136. data/lib/puppet/provider/package/nim.rb +8 -4
  137. data/lib/puppet/provider/package/openbsd.rb +14 -8
  138. data/lib/puppet/provider/package/opkg.rb +2 -1
  139. data/lib/puppet/provider/package/pacman.rb +2 -1
  140. data/lib/puppet/provider/package/pip.rb +2 -1
  141. data/lib/puppet/provider/package/pkgdmg.rb +4 -2
  142. data/lib/puppet/provider/package/pkgng.rb +4 -2
  143. data/lib/puppet/provider/package/pkgutil.rb +2 -1
  144. data/lib/puppet/provider/package/portupgrade.rb +2 -1
  145. data/lib/puppet/provider/package/rpm.rb +8 -4
  146. data/lib/puppet/provider/package/windows/package.rb +2 -1
  147. data/lib/puppet/provider/parsedfile.rb +14 -7
  148. data/lib/puppet/provider/service/base.rb +7 -4
  149. data/lib/puppet/provider/service/launchd.rb +4 -2
  150. data/lib/puppet/provider/service/service.rb +2 -1
  151. data/lib/puppet/provider/service/upstart.rb +11 -8
  152. data/lib/puppet/provider/user/directoryservice.rb +2 -1
  153. data/lib/puppet/provider/user/hpux.rb +1 -1
  154. data/lib/puppet/provider/user/ldap.rb +8 -4
  155. data/lib/puppet/provider/user/openbsd.rb +2 -1
  156. data/lib/puppet/provider/user/pw.rb +2 -1
  157. data/lib/puppet/provider/user/user_role_add.rb +4 -2
  158. data/lib/puppet/provider/user/useradd.rb +7 -4
  159. data/lib/puppet/reference/providers.rb +2 -3
  160. data/lib/puppet/reference/type.rb +4 -2
  161. data/lib/puppet/relationship.rb +4 -9
  162. data/lib/puppet/resource.rb +16 -9
  163. data/lib/puppet/resource/capability_finder.rb +12 -8
  164. data/lib/puppet/resource/catalog.rb +36 -40
  165. data/lib/puppet/resource/type.rb +7 -3
  166. data/lib/puppet/resource/type_collection.rb +4 -2
  167. data/lib/puppet/settings.rb +36 -19
  168. data/lib/puppet/settings/base_setting.rb +2 -1
  169. data/lib/puppet/settings/config_file.rb +2 -1
  170. data/lib/puppet/settings/file_setting.rb +2 -1
  171. data/lib/puppet/settings/ini_file.rb +2 -1
  172. data/lib/puppet/ssl/base.rb +2 -1
  173. data/lib/puppet/ssl/host.rb +16 -8
  174. data/lib/puppet/ssl/key.rb +2 -2
  175. data/lib/puppet/ssl/state_machine.rb +22 -3
  176. data/lib/puppet/transaction/event.rb +2 -1
  177. data/lib/puppet/transaction/event_manager.rb +4 -2
  178. data/lib/puppet/transaction/report.rb +10 -10
  179. data/lib/puppet/transaction/resource_harness.rb +4 -2
  180. data/lib/puppet/type.rb +84 -48
  181. data/lib/puppet/type/component.rb +2 -1
  182. data/lib/puppet/type/exec.rb +11 -7
  183. data/lib/puppet/type/file.rb +15 -9
  184. data/lib/puppet/type/file/content.rb +7 -3
  185. data/lib/puppet/type/file/ctime.rb +2 -1
  186. data/lib/puppet/type/file/data_sync.rb +2 -1
  187. data/lib/puppet/type/file/ensure.rb +10 -7
  188. data/lib/puppet/type/file/mode.rb +2 -1
  189. data/lib/puppet/type/file/mtime.rb +2 -1
  190. data/lib/puppet/type/file/selcontext.rb +2 -1
  191. data/lib/puppet/type/file/source.rb +6 -7
  192. data/lib/puppet/type/file/target.rb +2 -1
  193. data/lib/puppet/type/file/type.rb +2 -1
  194. data/lib/puppet/type/package.rb +6 -3
  195. data/lib/puppet/type/resources.rb +2 -1
  196. data/lib/puppet/type/service.rb +2 -1
  197. data/lib/puppet/type/tidy.rb +14 -7
  198. data/lib/puppet/type/user.rb +19 -7
  199. data/lib/puppet/util.rb +6 -3
  200. data/lib/puppet/util/checksums.rb +1 -1
  201. data/lib/puppet/util/classgen.rb +12 -6
  202. data/lib/puppet/util/command_line.rb +8 -4
  203. data/lib/puppet/util/connection.rb +4 -2
  204. data/lib/puppet/util/diff.rb +4 -2
  205. data/lib/puppet/util/execution.rb +4 -2
  206. data/lib/puppet/util/feature.rb +7 -4
  207. data/lib/puppet/util/fileparsing.rb +57 -46
  208. data/lib/puppet/util/filetype.rb +2 -1
  209. data/lib/puppet/util/http_proxy.rb +2 -1
  210. data/lib/puppet/util/instance_loader.rb +2 -1
  211. data/lib/puppet/util/ldap/connection.rb +4 -2
  212. data/lib/puppet/util/ldap/manager.rb +6 -3
  213. data/lib/puppet/util/log.rb +6 -3
  214. data/lib/puppet/util/metric.rb +2 -1
  215. data/lib/puppet/util/posix.rb +4 -2
  216. data/lib/puppet/util/rdoc/code_objects.rb +2 -1
  217. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +4 -2
  218. data/lib/puppet/util/selinux.rb +2 -1
  219. data/lib/puppet/version.rb +2 -5
  220. data/locales/puppet.pot +713 -685
  221. data/man/man5/puppet.conf.5 +9 -2
  222. data/man/man8/puppet-agent.8 +1 -1
  223. data/man/man8/puppet-apply.8 +1 -1
  224. data/man/man8/puppet-catalog.8 +1 -1
  225. data/man/man8/puppet-config.8 +1 -1
  226. data/man/man8/puppet-describe.8 +1 -1
  227. data/man/man8/puppet-device.8 +1 -1
  228. data/man/man8/puppet-doc.8 +1 -1
  229. data/man/man8/puppet-epp.8 +1 -1
  230. data/man/man8/puppet-facts.8 +1 -1
  231. data/man/man8/puppet-filebucket.8 +1 -1
  232. data/man/man8/puppet-generate.8 +1 -1
  233. data/man/man8/puppet-help.8 +1 -1
  234. data/man/man8/puppet-key.8 +1 -1
  235. data/man/man8/puppet-lookup.8 +1 -1
  236. data/man/man8/puppet-man.8 +1 -1
  237. data/man/man8/puppet-module.8 +1 -1
  238. data/man/man8/puppet-node.8 +1 -1
  239. data/man/man8/puppet-parser.8 +1 -1
  240. data/man/man8/puppet-plugin.8 +1 -1
  241. data/man/man8/puppet-report.8 +1 -1
  242. data/man/man8/puppet-resource.8 +1 -1
  243. data/man/man8/puppet-script.8 +1 -1
  244. data/man/man8/puppet-ssl.8 +1 -1
  245. data/man/man8/puppet-status.8 +1 -1
  246. data/man/man8/puppet.8 +2 -2
  247. data/spec/lib/puppet_spec/modules.rb +16 -2
  248. data/spec/unit/indirector/request_spec.rb +5 -6
  249. data/spec/unit/info_service_spec.rb +48 -0
  250. data/spec/unit/module_spec.rb +73 -0
  251. data/spec/unit/plan_spec.rb +65 -0
  252. data/spec/unit/puppet_pal_catalog_spec.rb +12 -0
  253. data/spec/unit/ssl/state_machine_spec.rb +68 -5
  254. metadata +6 -2
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+ require 'puppet_spec/files'
3
+ require 'puppet_spec/modules'
4
+ require 'puppet/module/plan'
5
+
6
+ describe Puppet::Module::Plan do
7
+ include PuppetSpec::Files
8
+
9
+ let(:modpath) { tmpdir('plan_modpath') }
10
+ let(:mymodpath) { File.join(modpath, 'mymod') }
11
+ let(:othermodpath) { File.join(modpath, 'othermod') }
12
+ let(:mymod) { Puppet::Module.new('mymod', mymodpath, nil) }
13
+ let(:othermod) { Puppet::Module.new('othermod', othermodpath, nil) }
14
+ let(:plans_path) { File.join(mymodpath, 'plans') }
15
+ let(:other_plans_path) { File.join(othermodpath, 'plans') }
16
+ let(:plans_glob) { File.join(mymodpath, 'plans', '*') }
17
+
18
+ describe :naming do
19
+ word = (Puppet::Module::Plan::RESERVED_WORDS - Puppet::Module::Plan::RESERVED_DATA_TYPES).sample
20
+ datatype = (Puppet::Module::Plan::RESERVED_DATA_TYPES - Puppet::Module::Plan::RESERVED_WORDS).sample
21
+ test_cases = { 'iLegal.pp' => 'Plan names must start with a lowercase letter and be composed of only lowercase letters, numbers, and underscores',
22
+ 'name.md' => 'Plan name cannot have extension .md, must be .pp or .yaml',
23
+ "#{word}.pp" => "Plan name cannot be a reserved word, but was '#{word}'",
24
+ "#{datatype}.pp" => "Plan name cannot be a Puppet data type, but was '#{datatype}'",
25
+ 'test_1.pp' => nil,
26
+ 'test_2.yaml' => nil }
27
+ test_cases.each do |filename, error|
28
+ it "constructs plans when needed with #{filename}" do
29
+ name = File.basename(filename, '.*')
30
+ if error
31
+ expect { Puppet::Module::Plan.new(mymod, name, [File.join(plans_path, filename)]) }
32
+ .to raise_error(Puppet::Module::Plan::InvalidName,
33
+ error)
34
+ else
35
+ expect { Puppet::Module::Plan.new(mymod, name, [filename]) }
36
+ .not_to raise_error
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ it "finds all plans in module" do
43
+ og_files = %w{plan1.pp plan2.yaml not-a-plan.ok}.map { |bn| "#{plans_path}/#{bn}" }
44
+ expect(Dir).to receive(:glob).with(plans_glob).and_return(og_files)
45
+
46
+ plans = Puppet::Module::Plan.plans_in_module(mymod)
47
+
48
+ expect(plans.count).to eq(2)
49
+ end
50
+
51
+ it "selects .pp file before .yaml" do
52
+ og_files = %w{plan1.pp plan1.yaml}.map { |bn| "#{plans_path}/#{bn}" }
53
+ expect(Dir).to receive(:glob).with(plans_glob).and_return(og_files)
54
+
55
+ plans = Puppet::Module::Plan.plans_in_module(mymod)
56
+
57
+ expect(plans.count).to eq(1)
58
+ expect(plans.first.files.count).to eq(1)
59
+ expect(plans.first.files.first['name']).to eq('plan1.pp')
60
+ end
61
+
62
+ it "gives the 'init' plan a name that is just the module's name" do
63
+ expect(Puppet::Module::Plan.new(mymod, 'init', ["#{plans_path}/init.pp"]).name).to eq('mymod')
64
+ end
65
+ end
@@ -111,6 +111,18 @@ describe 'Puppet Pal' do
111
111
  expect(resource.title).to eq('test')
112
112
  end
113
113
 
114
+ context 'catalog_data_hash' do
115
+ it 'produces a data_hash encoding of a catalog' do
116
+ result = Puppet::Pal.in_tmp_environment('pal_env', modulepath: modulepath, facts: node_facts) do |pal|
117
+ pal.with_catalog_compiler {|c|
118
+ c.evaluate_string("notify {'test': message => /a regexp/}")
119
+ c.catalog_data_hash
120
+ }
121
+ end
122
+ expect(result['resources']).to include(include('type' => 'Notify'))
123
+ end
124
+ end
125
+
114
126
  context 'the with_json_encoding()' do
115
127
 
116
128
  it 'produces json for a catalog' do
@@ -17,12 +17,11 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
17
17
 
18
18
  let(:cacert_pem) { cacert.to_pem }
19
19
  let(:cacert) { cert_fixture('ca.pem') }
20
- let(:cacerts) { [cacert] }
20
+ let(:cacerts) { [cacert, cert_fixture('intermediate.pem')] }
21
21
 
22
22
  let(:crl_pem) { crl.to_pem }
23
23
  let(:crl) { crl_fixture('crl.pem') }
24
- let(:crls) { [crl] }
25
-
24
+ let(:crls) { [crl, crl_fixture('intermediate-crl.pem')] }
26
25
  let(:private_key) { key_fixture('signed-key.pem') }
27
26
  let(:client_cert) { cert_fixture('signed.pem') }
28
27
 
@@ -38,6 +37,16 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
38
37
  allow(Kernel).to receive(:sleep)
39
38
  end
40
39
 
40
+ context 'when passing keyword arguments' do
41
+ it "accepts digest" do
42
+ expect(described_class.new(digest: 'SHA512').digest).to eq('SHA512')
43
+ end
44
+
45
+ it "accepts ca_fingerprint" do
46
+ expect(described_class.new(ca_fingerprint: 'CAFE').ca_fingerprint).to eq('CAFE')
47
+ end
48
+ end
49
+
41
50
  context 'when ensuring CA certs and CRLs' do
42
51
  it 'returns an SSLContext with the loaded CA certs and CRLs' do
43
52
  allow(cert_provider).to receive(:load_cacerts).and_return(cacerts)
@@ -109,6 +118,23 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
109
118
  expect(ssl_context[:client_cert]).to eq(client_cert)
110
119
  end
111
120
 
121
+ it 'uses the specified digest to log the cert chain fingerprints' do
122
+ allow(cert_provider).to receive(:load_cacerts).and_return(cacerts)
123
+ allow(cert_provider).to receive(:load_crls).and_return(crls)
124
+ allow(cert_provider).to receive(:load_private_key).and_return(private_key)
125
+ allow(cert_provider).to receive(:load_client_cert).and_return(client_cert)
126
+
127
+ Puppet[:log_level] = :debug
128
+ machine = described_class.new(cert_provider: cert_provider, digest: 'SHA512')
129
+ machine.ensure_client_certificate
130
+
131
+ expect(@logs).to include(
132
+ an_object_having_attributes(message: /Verified CA certificate 'CN=Test CA' fingerprint \(SHA512\)/),
133
+ an_object_having_attributes(message: /Verified CA certificate 'CN=Test CA Subauthority' fingerprint \(SHA512\)/),
134
+ an_object_having_attributes(message: /Verified client certificate 'CN=signed' fingerprint \(SHA512\)/)
135
+ )
136
+ end
137
+
112
138
  context 'when exceptions occur' do
113
139
  before :each do
114
140
  allow(cert_provider).to receive(:load_cacerts).and_return(cacerts)
@@ -269,7 +295,7 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
269
295
  stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: cacert_pem)
270
296
 
271
297
  st = state.next_state
272
- expect(st.ssl_context[:cacerts].map(&:to_pem)).to eq(cacerts.map(&:to_pem))
298
+ expect(st.ssl_context[:cacerts].map(&:to_pem)).to eq([cacert_pem])
273
299
  expect(File).to be_exist(Puppet[:localcacert])
274
300
  end
275
301
 
@@ -318,6 +344,41 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
318
344
 
319
345
  expect(File).to_not exist(Puppet[:localcacert])
320
346
  end
347
+
348
+ context 'when verifying CA cert bundle' do
349
+ before :each do
350
+ allow(cert_provider).to receive(:load_cacerts).and_return(nil)
351
+ stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: cacert_pem)
352
+ allow(cert_provider).to receive(:save_cacerts)
353
+ end
354
+
355
+ it 'verifies CA cert bundle if a ca_fingerprint is given case-insensitively' do
356
+ Puppet[:log_level] = :info
357
+ machine = described_class.new(digest: 'SHA256', ca_fingerprint: 'caacf69bbbcdad9dbcda92dd2da3608b639d1aea4c314d6cc6823cdb32d8e0f8')
358
+ state = Puppet::SSL::StateMachine::NeedCACerts.new(machine)
359
+ state.next_state
360
+
361
+ expect(@logs).to include(an_object_having_attributes(message: "Verified CA bundle with digest (SHA256) CA:AC:F6:9B:BB:CD:AD:9D:BC:DA:92:DD:2D:A3:60:8B:63:9D:1A:EA:4C:31:4D:6C:C6:82:3C:DB:32:D8:E0:F8"))
362
+ end
363
+
364
+ it 'verifies CA cert bundle using non-default fingerprint' do
365
+ Puppet[:log_level] = :info
366
+ machine = described_class.new(digest: 'SHA512', ca_fingerprint: '3c9d1482b878913ad95c9631feac5090cb05c6eab9496178d6fd5c14a023da3b1a8650a3cbaac516d9a48caf0b0742e1ed7eebf55105c024c74834a45056a9d9')
367
+ state = Puppet::SSL::StateMachine::NeedCACerts.new(machine)
368
+ state.next_state
369
+
370
+ expect(@logs).to include(an_object_having_attributes(message: "Verified CA bundle with digest (SHA512) 3C:9D:14:82:B8:78:91:3A:D9:5C:96:31:FE:AC:50:90:CB:05:C6:EA:B9:49:61:78:D6:FD:5C:14:A0:23:DA:3B:1A:86:50:A3:CB:AA:C5:16:D9:A4:8C:AF:0B:07:42:E1:ED:7E:EB:F5:51:05:C0:24:C7:48:34:A4:50:56:A9:D9"))
371
+ end
372
+
373
+ it 'returns an error if verification fails' do
374
+ machine = described_class.new(digest: 'SHA256', ca_fingerprint: 'wrong!')
375
+ state = Puppet::SSL::StateMachine::NeedCACerts.new(machine)
376
+
377
+ st = state.next_state
378
+ expect(st).to be_an_instance_of(Puppet::SSL::StateMachine::Error)
379
+ expect(st.message).to eq("CA bundle with digest (SHA256) CA:AC:F6:9B:BB:CD:AD:9D:BC:DA:92:DD:2D:A3:60:8B:63:9D:1A:EA:4C:31:4D:6C:C6:82:3C:DB:32:D8:E0:F8 did not match expected digest WR:ON:G!")
380
+ end
381
+ end
321
382
  end
322
383
 
323
384
  context 'NeedCRLs' do
@@ -346,7 +407,7 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
346
407
  stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_pem)
347
408
 
348
409
  st = state.next_state
349
- expect(st.ssl_context[:crls].map(&:to_pem)).to eq(crls.map(&:to_pem))
410
+ expect(st.ssl_context[:crls].map(&:to_pem)).to eq([crl_pem])
350
411
  expect(File).to be_exist(Puppet[:hostcrl])
351
412
  end
352
413
 
@@ -496,6 +557,8 @@ describe Puppet::SSL::StateMachine, unless: Puppet::Util::Platform.jruby? do
496
557
  allow(cert_provider).to receive(:load_private_key).and_return(private_key)
497
558
  allow(cert_provider).to receive(:load_client_cert).and_return(cert_fixture('tampered-cert.pem'))
498
559
 
560
+ ssl_context = Puppet::SSL::SSLContext.new(cacerts: [cacert], crls: [crl])
561
+ state = Puppet::SSL::StateMachine::NeedKey.new(machine, ssl_context)
499
562
  expect {
500
563
  state.next_state
501
564
  }.to raise_error(Puppet::SSL::SSLError, %r{The certificate for 'CN=signed' does not match its private key})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.0
4
+ version: 6.7.0
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -690,6 +690,7 @@ files:
690
690
  - lib/puppet/indirector/yaml.rb
691
691
  - lib/puppet/info_service.rb
692
692
  - lib/puppet/info_service/class_information_service.rb
693
+ - lib/puppet/info_service/plan_information_service.rb
693
694
  - lib/puppet/info_service/task_information_service.rb
694
695
  - lib/puppet/interface.rb
695
696
  - lib/puppet/interface/action.rb
@@ -703,6 +704,7 @@ files:
703
704
  - lib/puppet/loaders.rb
704
705
  - lib/puppet/metatype/manager.rb
705
706
  - lib/puppet/module.rb
707
+ - lib/puppet/module/plan.rb
706
708
  - lib/puppet/module/task.rb
707
709
  - lib/puppet/module_tool.rb
708
710
  - lib/puppet/module_tool/applications.rb
@@ -2279,6 +2281,7 @@ files:
2279
2281
  - spec/unit/parser/scope_spec.rb
2280
2282
  - spec/unit/parser/templatewrapper_spec.rb
2281
2283
  - spec/unit/parser/type_loader_spec.rb
2284
+ - spec/unit/plan_spec.rb
2282
2285
  - spec/unit/pops/adaptable_spec.rb
2283
2286
  - spec/unit/pops/benchmark_spec.rb
2284
2287
  - spec/unit/pops/containment_spec.rb
@@ -3521,6 +3524,7 @@ test_files:
3521
3524
  - spec/unit/parser/scope_spec.rb
3522
3525
  - spec/unit/parser/templatewrapper_spec.rb
3523
3526
  - spec/unit/parser/type_loader_spec.rb
3527
+ - spec/unit/plan_spec.rb
3524
3528
  - spec/unit/pops/adaptable_spec.rb
3525
3529
  - spec/unit/pops/benchmark_spec.rb
3526
3530
  - spec/unit/pops/containment_spec.rb