puppet 7.19.0 → 7.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +31 -31
  3. data/lib/puppet/application/lookup.rb +5 -5
  4. data/lib/puppet/defaults.rb +14 -0
  5. data/lib/puppet/indirector/facts/facter.rb +5 -1
  6. data/lib/puppet/info_service/task_information_service.rb +10 -2
  7. data/lib/puppet/module/task.rb +6 -1
  8. data/lib/puppet/transaction/report.rb +18 -1
  9. data/lib/puppet/type/resources.rb +1 -6
  10. data/lib/puppet/type/tidy.rb +3 -2
  11. data/lib/puppet/type/user.rb +1 -3
  12. data/lib/puppet/type.rb +10 -0
  13. data/lib/puppet/version.rb +1 -1
  14. data/man/man5/puppet.conf.5 +18 -2
  15. data/man/man8/puppet-agent.8 +1 -1
  16. data/man/man8/puppet-apply.8 +1 -1
  17. data/man/man8/puppet-catalog.8 +1 -1
  18. data/man/man8/puppet-config.8 +1 -1
  19. data/man/man8/puppet-describe.8 +1 -1
  20. data/man/man8/puppet-device.8 +1 -1
  21. data/man/man8/puppet-doc.8 +1 -1
  22. data/man/man8/puppet-epp.8 +1 -1
  23. data/man/man8/puppet-facts.8 +1 -1
  24. data/man/man8/puppet-filebucket.8 +1 -1
  25. data/man/man8/puppet-generate.8 +1 -1
  26. data/man/man8/puppet-help.8 +1 -1
  27. data/man/man8/puppet-lookup.8 +1 -1
  28. data/man/man8/puppet-module.8 +1 -1
  29. data/man/man8/puppet-node.8 +1 -1
  30. data/man/man8/puppet-parser.8 +1 -1
  31. data/man/man8/puppet-plugin.8 +1 -1
  32. data/man/man8/puppet-report.8 +1 -1
  33. data/man/man8/puppet-resource.8 +1 -1
  34. data/man/man8/puppet-script.8 +1 -1
  35. data/man/man8/puppet-ssl.8 +1 -1
  36. data/man/man8/puppet.8 +2 -2
  37. data/spec/integration/application/agent_spec.rb +99 -0
  38. data/spec/integration/application/lookup_spec.rb +55 -0
  39. data/spec/unit/agent_spec.rb +1 -1
  40. data/spec/unit/confiner_spec.rb +1 -1
  41. data/spec/unit/http/service/compiler_spec.rb +1 -1
  42. data/spec/unit/indirector/facts/facter_spec.rb +10 -0
  43. data/spec/unit/indirector/indirection_spec.rb +1 -1
  44. data/spec/unit/info_service_spec.rb +21 -0
  45. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  46. data/spec/unit/network/formats_spec.rb +1 -1
  47. data/spec/unit/provider/ldap_spec.rb +2 -2
  48. data/spec/unit/provider/package/dpkg_spec.rb +3 -3
  49. data/spec/unit/provider/package/pkgutil_spec.rb +4 -4
  50. data/spec/unit/provider/parsedfile_spec.rb +4 -4
  51. data/spec/unit/reports/store_spec.rb +5 -1
  52. data/spec/unit/task_spec.rb +11 -0
  53. data/spec/unit/transaction/event_manager_spec.rb +2 -2
  54. data/spec/unit/transaction/report_spec.rb +38 -1
  55. data/spec/unit/transaction_spec.rb +2 -2
  56. data/spec/unit/type/file_spec.rb +4 -4
  57. data/spec/unit/type/filebucket_spec.rb +3 -3
  58. data/spec/unit/type/resources_spec.rb +14 -0
  59. data/spec/unit/type/tidy_spec.rb +27 -17
  60. data/spec/unit/util/execution_spec.rb +6 -6
  61. data/spec/unit/util/network_device_spec.rb +1 -6
  62. data/spec/unit/util/storage_spec.rb +1 -1
  63. data/spec/unit/x509/cert_provider_spec.rb +1 -1
  64. data/tasks/manpages.rake +5 -0
  65. metadata +2 -2
@@ -141,27 +141,20 @@ describe tidy do
141
141
  describe "and generating files" do
142
142
  it "should set the backup on the file if backup is set on the tidy instance" do
143
143
  @tidy[:backup] = "whatever"
144
- expect(Puppet::Type.type(:file)).to receive(:new).with(hash_including(backup: "whatever"))
145
144
 
146
- @tidy.mkfile(@basepath)
145
+ expect(@tidy.mkfile(@basepath)[:backup]).to eq("whatever")
147
146
  end
148
147
 
149
148
  it "should set the file's path to the tidy's path" do
150
- expect(Puppet::Type.type(:file)).to receive(:new).with(hash_including(path: @basepath))
151
-
152
- @tidy.mkfile(@basepath)
149
+ expect(@tidy.mkfile(@basepath)[:path]).to eq(@basepath)
153
150
  end
154
151
 
155
152
  it "should configure the file for deletion" do
156
- expect(Puppet::Type.type(:file)).to receive(:new).with(hash_including(ensure: :absent))
157
-
158
- @tidy.mkfile(@basepath)
153
+ expect(@tidy.mkfile(@basepath)[:ensure]).to eq(:absent)
159
154
  end
160
155
 
161
156
  it "should force deletion on the file" do
162
- expect(Puppet::Type.type(:file)).to receive(:new).with(hash_including(force: true))
163
-
164
- @tidy.mkfile(@basepath)
157
+ expect(@tidy.mkfile(@basepath)[:force]).to eq(true)
165
158
  end
166
159
 
167
160
  it "should do nothing if the targeted file does not exist" do
@@ -196,7 +189,7 @@ describe tidy do
196
189
  end
197
190
 
198
191
  it "should use a Fileset with default max_files for infinite recursion" do
199
- expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, :recurse => true, :max_files=>0).and_return(@fileset)
192
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :max_files=>0}).and_return(@fileset)
200
193
  expect(@fileset).to receive(:files).and_return(%w{. one two})
201
194
  allow(@tidy).to receive(:tidy?).and_return(false)
202
195
 
@@ -205,7 +198,7 @@ describe tidy do
205
198
 
206
199
  it "should use a Fileset with default max_files for limited recursion" do
207
200
  @tidy[:recurse] = 42
208
- expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, :recurse => true, :recurselimit => 42, :max_files=>0).and_return(@fileset)
201
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :recurselimit => 42, :max_files=>0}).and_return(@fileset)
209
202
  expect(@fileset).to receive(:files).and_return(%w{. one two})
210
203
  allow(@tidy).to receive(:tidy?).and_return(false)
211
204
 
@@ -215,7 +208,7 @@ describe tidy do
215
208
  it "should use a Fileset with max_files for limited recursion" do
216
209
  @tidy[:recurse] = 42
217
210
  @tidy[:max_files] = 9876
218
- expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, :recurse => true, :recurselimit => 42, :max_files=>9876).and_return(@fileset)
211
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :recurselimit => 42, :max_files=>9876}).and_return(@fileset)
219
212
  expect(@fileset).to receive(:files).and_return(%w{. one two})
220
213
  allow(@tidy).to receive(:tidy?).and_return(false)
221
214
 
@@ -428,7 +421,7 @@ describe tidy do
428
421
  @tidy[:recurse] = true
429
422
  @tidy[:rmdirs] = true
430
423
  fileset = double('fileset')
431
- expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, :recurse => true, :max_files=>0).and_return(fileset)
424
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :max_files=>0}).and_return(fileset)
432
425
  expect(fileset).to receive(:files).and_return(%w{. one two one/subone two/subtwo one/subone/ssone})
433
426
  allow(@tidy).to receive(:tidy?).and_return(true)
434
427
 
@@ -450,7 +443,7 @@ describe tidy do
450
443
  @tidy[:recurse] = true
451
444
  @tidy[:rmdirs] = true
452
445
  fileset = double('fileset')
453
- expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, :recurse => true, :max_files=>0).and_return(fileset)
446
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :max_files=>0}).and_return(fileset)
454
447
  expect(fileset).to receive(:files).and_return(%w{. a a/2 a/1 a/3})
455
448
  allow(@tidy).to receive(:tidy?).and_return(true)
456
449
 
@@ -463,7 +456,7 @@ describe tidy do
463
456
  @tidy[:noop] = true
464
457
 
465
458
  fileset = double('fileset')
466
- expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, :recurse => true, :max_files=>0).and_return(fileset)
459
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :max_files=>0}).and_return(fileset)
467
460
  expect(fileset).to receive(:files).and_return(%w{. a a/2 a/1 a/3})
468
461
  allow(@tidy).to receive(:tidy?).and_return(true)
469
462
 
@@ -471,6 +464,23 @@ describe tidy do
471
464
 
472
465
  expect(result.values).to all(be_noop)
473
466
  end
467
+
468
+ it "generates resources whose schedule parameter matches the managed resource's schedule parameter" do
469
+ @tidy[:recurse] = true
470
+ @tidy[:schedule] = 'fake_schedule'
471
+
472
+ fileset = double('fileset')
473
+ expect(Puppet::FileServing::Fileset).to receive(:new).with(@basepath, {:recurse => true, :max_files=>0}).and_return(fileset)
474
+ expect(fileset).to receive(:files).and_return(%w{. a a/2 a/1 a/3})
475
+ allow(@tidy).to receive(:tidy?).and_return(true)
476
+
477
+ result = @tidy.generate.inject({}) { |hash, res| hash[res[:path]] = res; hash }
478
+
479
+ result.each do |file_resource|
480
+ expect(file_resource[1][:schedule]).to eq('fake_schedule')
481
+ end
482
+
483
+ end
474
484
  end
475
485
 
476
486
  def lstat_is(path, stat)
@@ -153,11 +153,11 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
153
153
  end
154
154
 
155
155
  it "should create a new process for the command" do
156
- expect(Process).to receive(:create).with(
156
+ expect(Process).to receive(:create).with({
157
157
  :command_line => "test command",
158
158
  :startup_info => {:stdin => @stdin, :stdout => @stdout, :stderr => @stderr},
159
159
  :close_handles => false
160
- ).and_return(proc_info_stub)
160
+ }).and_return(proc_info_stub)
161
161
 
162
162
  call_exec_windows('test command', {}, @stdin, @stdout, @stderr)
163
163
  end
@@ -165,7 +165,7 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
165
165
  context 'cwd option' do
166
166
  let(:cwd) { 'cwd' }
167
167
  it "should execute the command in the specified working directory" do
168
- expect(Process).to receive(:create).with(
168
+ expect(Process).to receive(:create).with({
169
169
  :command_line => "test command",
170
170
  :startup_info => {
171
171
  :stdin => @stdin,
@@ -174,7 +174,7 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
174
174
  },
175
175
  :close_handles => false,
176
176
  :cwd => cwd
177
- )
177
+ })
178
178
 
179
179
  call_exec_windows('test command', { :cwd => cwd }, @stdin, @stdout, @stderr)
180
180
  end
@@ -192,7 +192,7 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
192
192
  context 'suppress_window option' do
193
193
  let(:cwd) { 'cwd' }
194
194
  it "should execute the command in the specified working directory" do
195
- expect(Process).to receive(:create).with(
195
+ expect(Process).to receive(:create).with({
196
196
  :command_line => "test command",
197
197
  :startup_info => {
198
198
  :stdin => @stdin,
@@ -201,7 +201,7 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
201
201
  },
202
202
  :close_handles => false,
203
203
  :creation_flags => Puppet::Util::Windows::Process::CREATE_NO_WINDOW
204
- )
204
+ })
205
205
 
206
206
  call_exec_windows('test command', { :suppress_window => true }, @stdin, @stdout, @stderr)
207
207
  end
@@ -20,14 +20,9 @@ describe Puppet::Util::NetworkDevice do
20
20
  end
21
21
 
22
22
  describe "when initializing the remote network device singleton" do
23
- it "should load the network device code" do
24
- expect(Puppet::Util::NetworkDevice).to receive(:require)
25
- Puppet::Util::NetworkDevice.init(@device)
26
- end
27
-
28
23
  it "should create a network device instance" do
29
24
  allow(Puppet::Util::NetworkDevice).to receive(:require)
30
- expect(Puppet::Util::NetworkDevice::Test::Device).to receive(:new).with("telnet://admin:password@127.0.0.1", :debug => false)
25
+ expect(Puppet::Util::NetworkDevice::Test::Device).to receive(:new).with("telnet://admin:password@127.0.0.1", {:debug => false})
31
26
  Puppet::Util::NetworkDevice.init(@device)
32
27
  end
33
28
 
@@ -170,7 +170,7 @@ describe Puppet::Util::Storage do
170
170
  it 'should load Time and Symbols' do
171
171
  state = {
172
172
  'File[/etc/puppetlabs/puppet]' =>
173
- { :checked => Time.new('2018-08-08 15:28:25.546999000 -07:00') }
173
+ { :checked => Time.new(2018, 8, 8, 15, 28, 25, "-07:00") }
174
174
  }
175
175
  write_state_file(YAML.dump(state))
176
176
 
@@ -135,7 +135,7 @@ describe Puppet::X509::CertProvider do
135
135
 
136
136
  expect {
137
137
  create_provider(crlpath: crl_path).load_crls
138
- }.to raise_error(OpenSSL::X509::CRLError, 'nested asn1 error')
138
+ }.to raise_error(OpenSSL::X509::CRLError, /(PEM_read_bio_X509_CRL: bad base64 decode|nested asn1 error)/)
139
139
  end
140
140
 
141
141
  it 'raises if the input is empty' do
data/tasks/manpages.rake CHANGED
@@ -13,6 +13,11 @@ task :gen_manpages do
13
13
 
14
14
  ronn_args = '--manual="Puppet manual" --organization="Puppet, Inc." --roff'
15
15
 
16
+ unless ENV['SOURCE_DATE_EPOCH'].nil?
17
+ source_date = Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).strftime('%Y-%m-%d')
18
+ ronn_args += " --date=#{source_date}"
19
+ end
20
+
16
21
  # Locate ronn
17
22
  begin
18
23
  require 'ronn'
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: 7.19.0
4
+ version: 7.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2022-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter