chef 18.6.2-universal-mingw-ucrt → 18.7.6-universal-mingw-ucrt

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -5
  3. data/chef.gemspec +17 -13
  4. data/lib/chef/compliance/default_attributes.rb +2 -2
  5. data/lib/chef/compliance/runner.rb +6 -1
  6. data/lib/chef/cookbook/metadata.rb +1 -1
  7. data/lib/chef/cookbook/remote_file_vendor.rb +1 -4
  8. data/lib/chef/data_collector.rb +14 -0
  9. data/lib/chef/event_dispatch/dispatcher.rb +0 -1
  10. data/lib/chef/provider/package/dnf/dnf_helper.py +7 -0
  11. data/lib/chef/provider/package/snap.rb +1 -1
  12. data/lib/chef/provider/registry_key.rb +2 -0
  13. data/lib/chef/resource/apt_repository.rb +83 -10
  14. data/lib/chef/resource/registry_key.rb +6 -0
  15. data/lib/chef/resource.rb +1 -0
  16. data/lib/chef/resource_reporter.rb +4 -0
  17. data/lib/chef/util/powershell/ps_credential.rb +10 -0
  18. data/lib/chef/version.rb +1 -1
  19. data/lib/chef/win32/registry.rb +0 -1
  20. data/spec/functional/assets/yumrepo-empty/repodata/repomd.xml +6 -6
  21. data/spec/functional/resource/registry_spec.rb +233 -609
  22. data/spec/tiny_server.rb +5 -2
  23. data/spec/unit/data_collector_spec.rb +106 -2
  24. data/spec/unit/provider/apt_repository_spec.rb +13 -8
  25. data/spec/unit/provider/registry_key_spec.rb +17 -17
  26. data/spec/unit/resource_reporter_spec.rb +57 -3
  27. data/spec/unit/util/powershell/ps_credential_spec.rb +6 -0
  28. metadata +20 -20
  29. /data/spec/functional/assets/yumrepo-empty/repodata/{01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2 → 01a3b-filelists.sqlite.bz2} +0 -0
  30. /data/spec/functional/assets/yumrepo-empty/repodata/{401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz → 401dc-filelists.xml.gz} +0 -0
  31. /data/spec/functional/assets/yumrepo-empty/repodata/{5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2 → 5dc1e-primary.sqlite.bz2} +0 -0
  32. /data/spec/functional/assets/yumrepo-empty/repodata/{6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz → 6bf96-other.xml.gz} +0 -0
  33. /data/spec/functional/assets/yumrepo-empty/repodata/{7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2 → 7c365-other.sqlite.bz2} +0 -0
  34. /data/spec/functional/assets/yumrepo-empty/repodata/{dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz → dabe2-primary.xml.gz} +0 -0
data/spec/tiny_server.rb CHANGED
@@ -19,6 +19,7 @@
19
19
  require "webrick"
20
20
  require "webrick/https"
21
21
  require "rack"
22
+ require "rackup"
22
23
  require "singleton"
23
24
  require "open-uri"
24
25
  require "chef/config"
@@ -91,7 +92,7 @@ module TinyServer
91
92
 
92
93
  def create_server(**extra_options)
93
94
  server = WEBrick::HTTPServer.new(**options, **extra_options)
94
- server.mount("/", Rack::Handler::WEBrick, API.instance)
95
+ server.mount("/", Rackup::Handler::WEBrick, API.instance)
95
96
  server
96
97
  end
97
98
  end
@@ -172,7 +173,9 @@ module TinyServer
172
173
 
173
174
  def initialize(response_code = 200, data = nil, headers = nil, &block)
174
175
  @response_code, @data = response_code, data
175
- @response_headers = headers ? HEADERS.merge(headers) : HEADERS
176
+ # .merge creates a new hash, headers is sometimes passed as nil, @response_headers gets mutated somewhere
177
+ # in processing
178
+ @response_headers = HEADERS.merge(headers || {})
176
179
  @block = block_given? ? block : nil
177
180
  end
178
181
 
@@ -627,7 +627,7 @@ describe Chef::DataCollector do
627
627
  events.resource_action_start(new_resource, :create)
628
628
  events.resource_current_state_loaded(new_resource, :create, current_resource)
629
629
 
630
- events.resource_action_start(implementation_resource , :create)
630
+ events.resource_action_start(implementation_resource, :create)
631
631
  events.resource_current_state_loaded(implementation_resource, :create, implementation_resource)
632
632
  events.resource_updated(implementation_resource, :create)
633
633
  events.resource_after_state_loaded(implementation_resource, :create, implementation_resource)
@@ -876,7 +876,6 @@ describe Chef::DataCollector do
876
876
  send_run_failed_or_completed_event
877
877
  end
878
878
  end
879
-
880
879
  end
881
880
  end
882
881
 
@@ -968,5 +967,110 @@ describe Chef::DataCollector do
968
967
  data_collector.send(:send_to_data_collector, message)
969
968
  end
970
969
  end
970
+
971
+ context "when processing Windows registry keys" do
972
+ let(:total_resource_count) { 1 }
973
+ let(:updated_resource_count) { 1 }
974
+ let(:status) { "success" }
975
+
976
+ before do
977
+ allow(ChefUtils).to receive(:windows?).and_return(true)
978
+ run_status.stop_clock
979
+ end
980
+
981
+ it "removes registry key values not present in after state" do
982
+ resource = {
983
+ "type" => :registry_key,
984
+ "before" => {
985
+ values: [
986
+ { name: "key1", value: "val1" },
987
+ { name: "key2", value: "val2" },
988
+ { name: "key3", value: "val3" },
989
+ ],
990
+ },
991
+ "after" => {
992
+ values: [
993
+ { name: "key1", value: "new_val1" },
994
+ { name: "key3", value: "new_val3" },
995
+ ],
996
+ },
997
+ }
998
+
999
+ message = {
1000
+ "resources" => [resource],
1001
+ }
1002
+
1003
+ # Verify that key2 was removed from before values
1004
+ expected_before_values = [
1005
+ { name: "key1", value: "val1" },
1006
+ { name: "key3", value: "val3" },
1007
+ ]
1008
+
1009
+ expect(http_client).to receive(:post).with(
1010
+ nil,
1011
+ hash_including("message_type" => "run_start"),
1012
+ { "Content-Type" => "application/json" }
1013
+ )
1014
+
1015
+ expect(http_client).to receive(:post).with(
1016
+ nil,
1017
+ hash_including(
1018
+ "resources" => array_including(
1019
+ hash_including(
1020
+ "before" => hash_including(
1021
+ values: array_including(expected_before_values)
1022
+ )
1023
+ )
1024
+ )
1025
+ ),
1026
+ { "Content-Type" => "application/json" }
1027
+ )
1028
+ allow(Chef::DataCollector::RunEndMessage).to receive(:construct_message).and_return(message)
1029
+ data_collector.send(:send_run_completion, message)
1030
+ end
1031
+
1032
+ it "handles missing values gracefully" do
1033
+ resource = {
1034
+ "type" => :registry_key,
1035
+ "before" => {},
1036
+ "after" => { values: [] },
1037
+ }
1038
+
1039
+ message = {
1040
+ "resources" => [resource],
1041
+ }
1042
+
1043
+ expect(http_client).to receive(:post).with(
1044
+ nil,
1045
+ hash_including("message_type" => "run_start"),
1046
+ { "Content-Type" => "application/json" }
1047
+ )
1048
+
1049
+ expect(http_client).to receive(:post).with(nil, message, { "Content-Type" => "application/json" })
1050
+
1051
+ allow(Chef::DataCollector::RunEndMessage).to receive(:construct_message).and_return(message)
1052
+ expect { data_collector.send(:send_run_completion, "success") }.not_to raise_error
1053
+ end
1054
+
1055
+ it "ignores non-registry resources" do
1056
+ resource = {
1057
+ "type" => :file,
1058
+ "before" => { content: "old" },
1059
+ "after" => { content: "new" },
1060
+ }
1061
+
1062
+ message = {
1063
+ "resources" => [resource],
1064
+ }
1065
+ expect(http_client).to receive(:post).with(nil,
1066
+ hash_including("message_type" => "run_start"),
1067
+ { "Content-Type" => "application/json" })
1068
+
1069
+ expect(http_client).to receive(:post).with(nil, message, { "Content-Type" => "application/json" })
1070
+
1071
+ allow(Chef::DataCollector::RunEndMessage).to receive(:construct_message).and_return(message)
1072
+ expect { data_collector.send(:send_run_completion, "success") }.not_to raise_error
1073
+ end
1074
+ end
971
1075
  end
972
1076
  end
@@ -246,43 +246,48 @@ C5986B4F1257FFA86632CBA746181433FBB75451
246
246
  describe "#build_repo" do
247
247
  it "creates a repository string" do
248
248
  target = "deb http://test/uri unstable main\n"
249
- expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, [])).to eql(target)
249
+ expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, nil, [])).to eql(target)
250
250
  end
251
251
 
252
252
  it "creates a repository string with spaces" do
253
253
  target = "deb http://test/uri%20with%20spaces unstable main\n"
254
- expect(provider.build_repo("http://test/uri with spaces", "unstable", "main", false, nil, [])).to eql(target)
254
+ expect(provider.build_repo("http://test/uri with spaces", "unstable", "main", false, nil, nil, [])).to eql(target)
255
255
  end
256
256
 
257
257
  it "creates a repository string with no distribution" do
258
258
  target = "deb http://test/uri main\n"
259
- expect(provider.build_repo("http://test/uri", nil, "main", false, nil, [])).to eql(target)
259
+ expect(provider.build_repo("http://test/uri", nil, "main", false, nil, nil, [])).to eql(target)
260
260
  end
261
261
 
262
262
  it "creates a repository string with source" do
263
263
  target = "deb http://test/uri unstable main\ndeb-src http://test/uri unstable main\n"
264
- expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, [], true)).to eql(target)
264
+ expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, nil, [], true)).to eql(target)
265
265
  end
266
266
 
267
267
  it "creates a repository string with trusted" do
268
268
  target = "deb [trusted=yes] http://test/uri unstable main\n"
269
- expect(provider.build_repo("http://test/uri", "unstable", "main", true, nil, [])).to eql(target)
269
+ expect(provider.build_repo("http://test/uri", "unstable", "main", true, nil, nil, [])).to eql(target)
270
+ end
271
+
272
+ it "creates a repository string with signed-by" do
273
+ target = "deb [signed-by=/etc/apt/keyrings/test.gpg] http://test/uri unstable main\n"
274
+ expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, "/etc/apt/keyrings/test.gpg", [])).to eql(target)
270
275
  end
271
276
 
272
277
  it "creates a repository string with custom options" do
273
278
  target = "deb [by-hash=no] http://test/uri unstable main\n"
274
- expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, ["by-hash=no"])).to eql(target)
279
+ expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, nil, ["by-hash=no"])).to eql(target)
275
280
  end
276
281
 
277
282
  it "creates a repository string with trusted, arch, and custom options" do
278
283
  target = "deb [arch=amd64 trusted=yes by-hash=no] http://test/uri unstable main\n"
279
- expect(provider.build_repo("http://test/uri", "unstable", "main", true, "amd64", ["by-hash=no"])).to eql(target)
284
+ expect(provider.build_repo("http://test/uri", "unstable", "main", true, "amd64", nil, ["by-hash=no"])).to eql(target)
280
285
  end
281
286
 
282
287
  it "handles a ppa repo" do
283
288
  target = "deb http://ppa.launchpad.net/chef/main/ubuntu unstable main\n"
284
289
  expect(provider).to receive(:make_ppa_url).with("ppa:chef/main").and_return("http://ppa.launchpad.net/chef/main/ubuntu")
285
- expect(provider.build_repo("ppa:chef/main", "unstable", "main", false, nil, [])).to eql(target)
290
+ expect(provider.build_repo("ppa:chef/main", "unstable", "main", false, nil, nil, [])).to eql(target)
286
291
  end
287
292
  end
288
293
  end
@@ -26,7 +26,7 @@ shared_examples_for "a registry key" do
26
26
  describe "when the key exists" do
27
27
  before(:each) do
28
28
  expect(@double_registry).to receive(:key_exists?).with(keyname).and_return(true)
29
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval2 )
29
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval2] )
30
30
  @provider.load_current_resource
31
31
  end
32
32
 
@@ -66,7 +66,7 @@ shared_examples_for "a registry key" do
66
66
  end
67
67
  it "should do nothing if the if a case insensitive key and the value both exist" do
68
68
  @provider.new_resource.key(keyname.downcase)
69
- expect(@double_registry).to receive(:get_values).with(keyname.downcase).and_return( testval1 )
69
+ expect(@double_registry).to receive(:get_values).with(keyname.downcase).and_return( [testval1 ])
70
70
  expect(@double_registry).not_to receive(:set_value)
71
71
  @provider.load_current_resource
72
72
  @provider.action_create
@@ -77,25 +77,25 @@ shared_examples_for "a registry key" do
77
77
  expect(@double_registry).to receive(:key_exists?).twice.with(keyname).and_return(true)
78
78
  end
79
79
  it "should do nothing if the key and the value both exist" do
80
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1 )
80
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1] )
81
81
  expect(@double_registry).not_to receive(:set_value)
82
82
  @provider.load_current_resource
83
83
  @provider.action_create
84
84
  end
85
85
  it "should create the value if the key exists but the value does not" do
86
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval2 )
86
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval2] )
87
87
  expect(@double_registry).to receive(:set_value).with(keyname, testval1)
88
88
  @provider.load_current_resource
89
89
  @provider.action_create
90
90
  end
91
91
  it "should set the value if the key exists but the data does not match" do
92
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1_wrong_data )
92
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1_wrong_data] )
93
93
  expect(@double_registry).to receive(:set_value).with(keyname, testval1)
94
94
  @provider.load_current_resource
95
95
  @provider.action_create
96
96
  end
97
97
  it "should set the value if the key exists but the type does not match" do
98
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1_wrong_type )
98
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1_wrong_type] )
99
99
  expect(@double_registry).to receive(:set_value).with(keyname, testval1)
100
100
  @provider.load_current_resource
101
101
  @provider.action_create
@@ -105,7 +105,7 @@ shared_examples_for "a registry key" do
105
105
  it "when a value is in the key, it should do nothing" do
106
106
  @provider.new_resource.values([])
107
107
  expect(@double_registry).to receive(:key_exists?).twice.with(keyname).and_return(true)
108
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1 )
108
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1] )
109
109
  expect(@double_registry).not_to receive(:create_key)
110
110
  expect(@double_registry).not_to receive(:set_value)
111
111
  @provider.load_current_resource
@@ -150,25 +150,25 @@ shared_examples_for "a registry key" do
150
150
  expect(@double_registry).to receive(:key_exists?).twice.with(keyname).and_return(true)
151
151
  end
152
152
  it "should do nothing if the key and the value both exist" do
153
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1 )
153
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1] )
154
154
  expect(@double_registry).not_to receive(:set_value)
155
155
  @provider.load_current_resource
156
156
  @provider.action_create_if_missing
157
157
  end
158
158
  it "should create the value if the key exists but the value does not" do
159
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval2 )
159
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval2] )
160
160
  expect(@double_registry).to receive(:set_value).with(keyname, testval1)
161
161
  @provider.load_current_resource
162
162
  @provider.action_create_if_missing
163
163
  end
164
164
  it "should not set the value if the key exists but the data does not match" do
165
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1_wrong_data )
165
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1_wrong_data] )
166
166
  expect(@double_registry).not_to receive(:set_value)
167
167
  @provider.load_current_resource
168
168
  @provider.action_create_if_missing
169
169
  end
170
170
  it "should not set the value if the key exists but the type does not match" do
171
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1_wrong_type )
171
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1_wrong_type] )
172
172
  expect(@double_registry).not_to receive(:set_value)
173
173
  @provider.load_current_resource
174
174
  @provider.action_create_if_missing
@@ -193,25 +193,25 @@ shared_examples_for "a registry key" do
193
193
  expect(@double_registry).to receive(:key_exists?).twice.with(keyname).and_return(true)
194
194
  end
195
195
  it "deletes the value when the value exists" do
196
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1 )
196
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1] )
197
197
  expect(@double_registry).to receive(:delete_value).with(keyname, testval1)
198
198
  @provider.load_current_resource
199
199
  @provider.action_delete
200
200
  end
201
201
  it "deletes the value when the value exists, but the type is wrong" do
202
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1_wrong_type )
202
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1_wrong_type] )
203
203
  expect(@double_registry).to receive(:delete_value).with(keyname, testval1)
204
204
  @provider.load_current_resource
205
205
  @provider.action_delete
206
206
  end
207
207
  it "deletes the value when the value exists, but the data is wrong" do
208
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1_wrong_data )
208
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1_wrong_data] )
209
209
  expect(@double_registry).to receive(:delete_value).with(keyname, testval1)
210
210
  @provider.load_current_resource
211
211
  @provider.action_delete
212
212
  end
213
213
  it "does not delete the value when the value does not exist" do
214
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval2 )
214
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval2] )
215
215
  expect(@double_registry).not_to receive(:delete_value)
216
216
  @provider.load_current_resource
217
217
  @provider.action_delete
@@ -235,7 +235,7 @@ shared_examples_for "a registry key" do
235
235
  expect(@double_registry).to receive(:key_exists?).twice.with(keyname).and_return(true)
236
236
  end
237
237
  it "deletes the key" do
238
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( testval1 )
238
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [testval1] )
239
239
  expect(@double_registry).to receive(:delete_key).with(keyname, false)
240
240
  @provider.load_current_resource
241
241
  @provider.action_delete_key
@@ -303,7 +303,7 @@ describe Chef::Provider::RegistryKey do
303
303
  end
304
304
 
305
305
  it "does not make a change for datatype of data value differing" do
306
- expect(@double_registry).to receive(:get_values).with(keyname).and_return( dword_passed_as_integer )
306
+ expect(@double_registry).to receive(:get_values).with(keyname).and_return( [dword_passed_as_integer] )
307
307
  expect(@double_registry).not_to receive(:set_value)
308
308
  @provider.load_current_resource
309
309
  @provider.action_create
@@ -73,7 +73,6 @@ describe Chef::ResourceReporter do
73
73
  end
74
74
 
75
75
  context "when first created" do
76
-
77
76
  it "has no updated resources" do
78
77
  expect(resource_reporter.updated_resources.count).to eq(0)
79
78
  end
@@ -89,7 +88,6 @@ describe Chef::ResourceReporter do
89
88
  it "should have no error_descriptions" do
90
89
  expect(resource_reporter.error_descriptions).to eq({})
91
90
  end
92
-
93
91
  end
94
92
 
95
93
  context "after the chef run completes" do
@@ -107,7 +105,6 @@ describe Chef::ResourceReporter do
107
105
  before do
108
106
  allow(rest_client).to receive(:raw_request).and_return({ "result" => "ok" })
109
107
  allow(rest_client).to receive(:post).and_return({ "uri" => "https://example.com/reports/nodes/spitfire/runs/#{@run_id}" })
110
-
111
108
  end
112
109
 
113
110
  context "before converging any resources" do
@@ -510,6 +507,63 @@ describe Chef::ResourceReporter do
510
507
  it_should_behave_like "a successful client run"
511
508
  end
512
509
 
510
+ context "windows registry_key resource" do
511
+ let(:current_resource) do
512
+ resource = Chef::Resource::RegistryKey.new('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager')
513
+ resource.values([{ name: "PendingFileRenameOperations", type: :multi_string, data: 10000.times.map { |n| "C:\\Windows\\System32\\config\\systemprofile\\AppData\\Local\\Temp\\2\\Chef-20140107123456-1234-#{n}" } } ])
514
+ resource
515
+ end
516
+
517
+ let(:new_resource) do
518
+ resource = Chef::Resource::RegistryKey.new('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager')
519
+ resource.values([ { name: "ProtectionMode", type: :dword, data: 1 } ])
520
+ allow(resource).to receive(:cookbook_name).and_return(cookbook_name)
521
+ allow(resource).to receive(:cookbook_version).and_return(cookbook_version)
522
+ resource
523
+ end
524
+
525
+ it "should raise an error when the data is too large" do
526
+ pending "Need to test truncation properly"
527
+ # Start the run
528
+ resource_reporter.run_started(run_status)
529
+ run_status.start_clock
530
+
531
+ # These 4 event callbacks are essential to populate resource state:
532
+ events.resource_action_start(new_resource, :create)
533
+ events.resource_current_state_loaded(new_resource, :create, current_resource)
534
+ events.resource_updated(new_resource, :create)
535
+ events.resource_completed(new_resource)
536
+
537
+ # Stop the run
538
+ run_status.stop_clock
539
+
540
+ # Prepare the run data - this will include the resource states
541
+ report_data = resource_reporter.prepare_run_data
542
+
543
+ # Verify the report includes our resource
544
+ expect(report_data["resources"].length).to eq(1)
545
+ expect(report_data["resources"][0]["before"]).to eq(current_resource.state_for_resource_reporter)
546
+ expect(report_data["resources"][0]["after"]).to eq(new_resource.state_for_resource_reporter)
547
+
548
+ expect(rest_client).to receive(:post) do |path, data, headers|
549
+ expect(path).to eq("reports/nodes/spitfire/runs")
550
+ raise Chef::Exceptions::ValidationFailed, "data too large" if data.length > 10000
551
+ end
552
+
553
+ # Now mock the actual post request to fail due to size
554
+ expect(rest_client).to receive(:raw_request) do |method, url, headers, data|
555
+ data_stream = Zlib::GzipReader.new(StringIO.new(data))
556
+ data = data_stream.read
557
+ expect(data).to include('"before":') # Verify current_resource state is included
558
+ expect(data).to include('"after":') # Verify new_resource state is included
559
+ raise Chef::Exceptions::ValidationFailed, "data too large"
560
+ end
561
+
562
+ # Assert that the post fails due to validation
563
+ expect { resource_reporter.run_completed(node) }.to raise_error(Chef::Exceptions::ValidationFailed)
564
+ end
565
+ end
566
+
513
567
  context "for an unsuccessful run" do
514
568
 
515
569
  before do
@@ -35,6 +35,12 @@ describe Chef::Util::Powershell::PSCredential do
35
35
  end
36
36
  end
37
37
 
38
+ context "when inspect is called" do
39
+ it "should not contain the password" do
40
+ expect(ps_credential.inspect).not_to match(/#{password}/)
41
+ end
42
+ end
43
+
38
44
  context "when to_text is called" do
39
45
  it "should not contain the password" do
40
46
  allow(ps_credential).to receive(:encrypt).with(password).and_return("encrypted")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.6.2
4
+ version: 18.7.6
5
5
  platform: universal-mingw-ucrt
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-12 00:00:00.000000000 Z
11
+ date: 2025-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 18.6.2
19
+ version: 18.7.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 18.6.2
26
+ version: 18.7.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 18.6.2
33
+ version: 18.7.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 18.6.2
40
+ version: 18.7.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -62,16 +62,16 @@ dependencies:
62
62
  name: train-winrm
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.2.5
67
+ version: 0.2.17
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.2.5
74
+ version: 0.2.17
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: train-rest
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +135,7 @@ dependencies:
135
135
  version: 2.0.3
136
136
  - - "<"
137
137
  - !ruby/object:Gem::Version
138
- version: '4.0'
138
+ version: '3.2'
139
139
  type: :runtime
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
@@ -145,7 +145,7 @@ dependencies:
145
145
  version: 2.0.3
146
146
  - - "<"
147
147
  - !ruby/object:Gem::Version
148
- version: '4.0'
148
+ version: '3.2'
149
149
  - !ruby/object:Gem::Dependency
150
150
  name: mixlib-authentication
151
151
  requirement: !ruby/object:Gem::Requirement
@@ -374,14 +374,14 @@ dependencies:
374
374
  requirements:
375
375
  - - ">="
376
376
  - !ruby/object:Gem::Version
377
- version: 14.0.11
377
+ version: 15.0.17
378
378
  type: :runtime
379
379
  prerelease: false
380
380
  version_requirements: !ruby/object:Gem::Requirement
381
381
  requirements:
382
382
  - - ">="
383
383
  - !ruby/object:Gem::Version
384
- version: 14.0.11
384
+ version: 15.0.17
385
385
  - !ruby/object:Gem::Dependency
386
386
  name: chef-vault
387
387
  requirement: !ruby/object:Gem::Requirement
@@ -2538,12 +2538,12 @@ files:
2538
2538
  - spec/functional/assets/mytest-1.0-1.noarch.rpm
2539
2539
  - spec/functional/assets/mytest-2.0-1.noarch.rpm
2540
2540
  - spec/functional/assets/testchefsubsys
2541
- - spec/functional/assets/yumrepo-empty/repodata/01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2
2542
- - spec/functional/assets/yumrepo-empty/repodata/401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz
2543
- - spec/functional/assets/yumrepo-empty/repodata/5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2
2544
- - spec/functional/assets/yumrepo-empty/repodata/6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz
2545
- - spec/functional/assets/yumrepo-empty/repodata/7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2
2546
- - spec/functional/assets/yumrepo-empty/repodata/dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz
2541
+ - spec/functional/assets/yumrepo-empty/repodata/01a3b-filelists.sqlite.bz2
2542
+ - spec/functional/assets/yumrepo-empty/repodata/401dc-filelists.xml.gz
2543
+ - spec/functional/assets/yumrepo-empty/repodata/5dc1e-primary.sqlite.bz2
2544
+ - spec/functional/assets/yumrepo-empty/repodata/6bf96-other.xml.gz
2545
+ - spec/functional/assets/yumrepo-empty/repodata/7c365-other.sqlite.bz2
2546
+ - spec/functional/assets/yumrepo-empty/repodata/dabe2-primary.xml.gz
2547
2547
  - spec/functional/assets/yumrepo-empty/repodata/repomd.xml
2548
2548
  - spec/functional/assets/yumrepo/chef_rpm-1.10-1.aarch64.rpm
2549
2549
  - spec/functional/assets/yumrepo/chef_rpm-1.10-1.i686.rpm