puppet 7.20.0 → 7.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +62 -48
  3. data/Guardfile.example +1 -1
  4. data/ext/project_data.yaml +1 -1
  5. data/ext/windows/service/daemon.rb +1 -1
  6. data/lib/puppet/application/lookup.rb +5 -5
  7. data/lib/puppet/defaults.rb +14 -0
  8. data/lib/puppet/indirector/facts/facter.rb +8 -1
  9. data/lib/puppet/info_service/task_information_service.rb +10 -2
  10. data/lib/puppet/transaction/report.rb +18 -1
  11. data/lib/puppet/type/resources.rb +1 -6
  12. data/lib/puppet/type/tidy.rb +3 -2
  13. data/lib/puppet/type/user.rb +1 -3
  14. data/lib/puppet/type.rb +10 -0
  15. data/lib/puppet/version.rb +1 -1
  16. data/man/man5/puppet.conf.5 +18 -2
  17. data/man/man8/puppet-agent.8 +1 -1
  18. data/man/man8/puppet-apply.8 +1 -1
  19. data/man/man8/puppet-catalog.8 +1 -1
  20. data/man/man8/puppet-config.8 +1 -1
  21. data/man/man8/puppet-describe.8 +1 -1
  22. data/man/man8/puppet-device.8 +1 -1
  23. data/man/man8/puppet-doc.8 +1 -1
  24. data/man/man8/puppet-epp.8 +1 -1
  25. data/man/man8/puppet-facts.8 +1 -1
  26. data/man/man8/puppet-filebucket.8 +1 -1
  27. data/man/man8/puppet-generate.8 +1 -1
  28. data/man/man8/puppet-help.8 +1 -1
  29. data/man/man8/puppet-lookup.8 +1 -1
  30. data/man/man8/puppet-module.8 +1 -1
  31. data/man/man8/puppet-node.8 +1 -1
  32. data/man/man8/puppet-parser.8 +1 -1
  33. data/man/man8/puppet-plugin.8 +1 -1
  34. data/man/man8/puppet-report.8 +1 -1
  35. data/man/man8/puppet-resource.8 +1 -1
  36. data/man/man8/puppet-script.8 +1 -1
  37. data/man/man8/puppet-ssl.8 +1 -1
  38. data/man/man8/puppet.8 +2 -2
  39. data/spec/integration/application/agent_spec.rb +100 -1
  40. data/spec/integration/application/lookup_spec.rb +55 -0
  41. data/spec/unit/agent_spec.rb +1 -1
  42. data/spec/unit/application/agent_spec.rb +1 -1
  43. data/spec/unit/application/device_spec.rb +1 -1
  44. data/spec/unit/application/resource_spec.rb +1 -1
  45. data/spec/unit/confiner_spec.rb +1 -1
  46. data/spec/unit/daemon_spec.rb +1 -1
  47. data/spec/unit/file_bucket/dipper_spec.rb +1 -1
  48. data/spec/unit/file_serving/fileset_spec.rb +14 -14
  49. data/spec/unit/file_system_spec.rb +3 -1
  50. data/spec/unit/graph/simple_graph_spec.rb +1 -1
  51. data/spec/unit/http/service/compiler_spec.rb +1 -1
  52. data/spec/unit/indirector/facts/facter_spec.rb +25 -0
  53. data/spec/unit/indirector/file_server_spec.rb +5 -5
  54. data/spec/unit/indirector/indirection_spec.rb +1 -1
  55. data/spec/unit/indirector/node/plain_spec.rb +1 -1
  56. data/spec/unit/info_service_spec.rb +21 -0
  57. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  58. data/spec/unit/network/formats_spec.rb +1 -1
  59. data/spec/unit/provider/file/posix_spec.rb +4 -4
  60. data/spec/unit/provider/ldap_spec.rb +3 -3
  61. data/spec/unit/provider/nameservice_spec.rb +15 -15
  62. data/spec/unit/provider/package/aix_spec.rb +1 -1
  63. data/spec/unit/provider/package/dpkg_spec.rb +3 -3
  64. data/spec/unit/provider/package/nim_spec.rb +2 -2
  65. data/spec/unit/provider/package/pkgutil_spec.rb +4 -4
  66. data/spec/unit/provider/parsedfile_spec.rb +4 -4
  67. data/spec/unit/provider/service/bsd_spec.rb +4 -4
  68. data/spec/unit/provider/service/debian_spec.rb +2 -2
  69. data/spec/unit/provider/service/gentoo_spec.rb +20 -20
  70. data/spec/unit/provider/service/openbsd_spec.rb +18 -18
  71. data/spec/unit/provider/service/openrc_spec.rb +19 -19
  72. data/spec/unit/provider/service/systemd_spec.rb +22 -22
  73. data/spec/unit/provider/service/upstart_spec.rb +6 -6
  74. data/spec/unit/provider/user/aix_spec.rb +1 -1
  75. data/spec/unit/provider/user/hpux_spec.rb +1 -1
  76. data/spec/unit/provider/user/openbsd_spec.rb +1 -1
  77. data/spec/unit/provider/user/useradd_spec.rb +1 -1
  78. data/spec/unit/reports/store_spec.rb +5 -1
  79. data/spec/unit/resource/type_spec.rb +2 -2
  80. data/spec/unit/ssl/base_spec.rb +1 -1
  81. data/spec/unit/ssl/certificate_request_spec.rb +1 -1
  82. data/spec/unit/ssl/certificate_spec.rb +1 -1
  83. data/spec/unit/transaction/event_manager_spec.rb +4 -4
  84. data/spec/unit/transaction/report_spec.rb +38 -1
  85. data/spec/unit/transaction_spec.rb +2 -2
  86. data/spec/unit/type/exec_spec.rb +1 -1
  87. data/spec/unit/type/file_spec.rb +4 -4
  88. data/spec/unit/type/filebucket_spec.rb +3 -3
  89. data/spec/unit/type/resources_spec.rb +14 -0
  90. data/spec/unit/type/tidy_spec.rb +27 -17
  91. data/spec/unit/util/backups_spec.rb +1 -1
  92. data/spec/unit/util/execution_spec.rb +6 -6
  93. data/spec/unit/util/filetype_spec.rb +3 -3
  94. data/spec/unit/util/network_device_spec.rb +1 -6
  95. data/spec/unit/util/resource_template_spec.rb +1 -1
  96. data/spec/unit/util/storage_spec.rb +1 -1
  97. data/spec/unit/x509/cert_provider_spec.rb +1 -1
  98. metadata +9 -3
@@ -270,6 +270,20 @@ describe resources do
270
270
  @catalog = Puppet::Resource::Catalog.new
271
271
  end
272
272
 
273
+ context "when the catalog contains a purging resource with an alias" do
274
+ before do
275
+ @resource = Puppet::Type.type(:resources).new(:name => "purgeable_test", :purge => true)
276
+ @catalog.add_resource @resource
277
+ @catalog.alias(@resource, "purgeable_test_alias")
278
+ end
279
+
280
+ it "should not copy the alias metaparameter" do
281
+ allow(Puppet::Type.type(:purgeable_test)).to receive(:instances).and_return([@purgee])
282
+ generated = @resource.generate.first
283
+ expect(generated[:alias]).to be_nil
284
+ end
285
+ end
286
+
273
287
  context "when dealing with non-purging resources" do
274
288
  before do
275
289
  @resources = Puppet::Type.type(:resources).new(:name => 'purgeable_test')
@@ -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)
@@ -80,7 +80,7 @@ describe Puppet::Util::Backups do
80
80
  end
81
81
 
82
82
  it "a copy should be created in the local directory" do
83
- expect(FileUtils).to receive(:cp_r).with(path, backup, :preserve => true)
83
+ expect(FileUtils).to receive(:cp_r).with(path, backup, {:preserve => true})
84
84
  allow(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true)
85
85
 
86
86
  expect(file.perform_backup).to be_truthy
@@ -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
@@ -16,7 +16,7 @@ describe Puppet::Util::FileType do
16
16
  describe "when the file already exists" do
17
17
  it "should return the file's contents when asked to read it" do
18
18
  expect(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true)
19
- expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding.default_external).and_return("my text")
19
+ expect(Puppet::FileSystem).to receive(:read).with(path, {:encoding => Encoding.default_external}).and_return("my text")
20
20
 
21
21
  expect(file.read).to eq("my text")
22
22
  end
@@ -46,7 +46,7 @@ describe Puppet::Util::FileType do
46
46
  end
47
47
 
48
48
  it "should first create a temp file and copy its contents over to the file location" do
49
- expect(Tempfile).to receive(:new).with("puppet", :encoding => Encoding.default_external).and_return(tempfile)
49
+ expect(Tempfile).to receive(:new).with("puppet", {:encoding => Encoding.default_external}).and_return(tempfile)
50
50
  expect(tempfile).to receive(:print).with("my text")
51
51
  expect(tempfile).to receive(:flush)
52
52
  expect(tempfile).to receive(:close)
@@ -163,7 +163,7 @@ describe Puppet::Util::FileType do
163
163
  @tmp_cron = Tempfile.new("puppet_crontab_spec")
164
164
  @tmp_cron_path = @tmp_cron.path
165
165
  allow(Puppet::Util).to receive(:uid).with(uid).and_return(9000)
166
- expect(Tempfile).to receive(:new).with("puppet_#{name}", :encoding => Encoding.default_external).and_return(@tmp_cron)
166
+ expect(Tempfile).to receive(:new).with("puppet_#{name}", {:encoding => Encoding.default_external}).and_return(@tmp_cron)
167
167
  end
168
168
 
169
169
  after :each do
@@ -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
 
@@ -38,7 +38,7 @@ describe Puppet::Util::ResourceTemplate do
38
38
  end
39
39
 
40
40
  it "should create a template instance with the contents of the file" do
41
- expect(Puppet::FileSystem).to receive(:read).with("/my/template", :encoding => 'utf-8').and_return("yay")
41
+ expect(Puppet::FileSystem).to receive(:read).with("/my/template", {:encoding => 'utf-8'}).and_return("yay")
42
42
  expect(Puppet::Util).to receive(:create_erb).with("yay").and_return(@template)
43
43
 
44
44
  allow(@wrapper).to receive(:set_resource_variables)
@@ -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
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.20.0
4
+ version: 7.22.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-10-06 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -133,6 +133,9 @@ dependencies:
133
133
  - - "~>"
134
134
  - !ruby/object:Gem::Version
135
135
  version: '1.0'
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.2.0
136
139
  type: :runtime
137
140
  prerelease: false
138
141
  version_requirements: !ruby/object:Gem::Requirement
@@ -140,6 +143,9 @@ dependencies:
140
143
  - - "~>"
141
144
  - !ruby/object:Gem::Version
142
145
  version: '1.0'
146
+ - - "<"
147
+ - !ruby/object:Gem::Version
148
+ version: 1.2.0
143
149
  - !ruby/object:Gem::Dependency
144
150
  name: deep_merge
145
151
  requirement: !ruby/object:Gem::Requirement
@@ -2538,7 +2544,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2538
2544
  - !ruby/object:Gem::Version
2539
2545
  version: 1.3.1
2540
2546
  requirements: []
2541
- rubygems_version: 3.1.6
2547
+ rubygems_version: 3.0.9
2542
2548
  signing_key:
2543
2549
  specification_version: 4
2544
2550
  summary: Puppet, an automated configuration management tool