chef-cli 5.6.16 → 5.6.20

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/chef-cli.gemspec +1 -1
  3. data/lib/chef-cli/policyfile/comparison_base.rb +1 -1
  4. data/lib/chef-cli/policyfile/local_lock_fetcher.rb +1 -1
  5. data/lib/chef-cli/policyfile/undo_stack.rb +1 -1
  6. data/lib/chef-cli/policyfile_lock.rb +1 -1
  7. data/lib/chef-cli/policyfile_services/export_repo.rb +1 -1
  8. data/lib/chef-cli/policyfile_services/install.rb +2 -2
  9. data/lib/chef-cli/policyfile_services/push.rb +1 -1
  10. data/lib/chef-cli/policyfile_services/push_archive.rb +1 -1
  11. data/lib/chef-cli/policyfile_services/update_attributes.rb +2 -2
  12. data/lib/chef-cli/skeletons/code_generator/recipes/cookbook_file.rb +1 -1
  13. data/lib/chef-cli/skeletons/code_generator/recipes/template.rb +1 -1
  14. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen.yml.erb +0 -1
  15. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +0 -1
  16. data/lib/chef-cli/version.rb +1 -1
  17. data/spec/shared/custom_generator_cookbook.rb +1 -1
  18. data/spec/unit/command/generator_commands/cookbook_spec.rb +6 -8
  19. data/spec/unit/command/generator_commands/generator_generator_spec.rb +1 -1
  20. data/spec/unit/command/generator_commands/policyfile_spec.rb +2 -2
  21. data/spec/unit/policyfile/artifactory_cookbook_source_spec.rb +2 -2
  22. data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +2 -2
  23. data/spec/unit/policyfile/community_cookbook_source_spec.rb +2 -2
  24. data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +1 -1
  25. data/spec/unit/policyfile/differ_spec.rb +8 -8
  26. data/spec/unit/policyfile/undo_stack_spec.rb +1 -1
  27. data/spec/unit/policyfile_lock_build_spec.rb +18 -0
  28. data/spec/unit/policyfile_lock_validation_spec.rb +2 -2
  29. data/spec/unit/policyfile_services/export_repo_spec.rb +7 -7
  30. data/spec/unit/policyfile_services/install_spec.rb +1 -1
  31. data/spec/unit/policyfile_services/update_attributes_spec.rb +1 -1
  32. metadata +13 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff005199291ce09bdcddf494ad3d120301f7e1df06245fddffe6d710fe1e8691
4
- data.tar.gz: ddbf80db9d5297b41505b3ee13143939476407e5cc47814a814d0b0be007c93a
3
+ metadata.gz: f219b019dc29d8ccf36df3de27450d1353ce9afc04b88c99c1700b9f828725ab
4
+ data.tar.gz: a0230c8cde5ba86ce76b8d347bd700cf24b75faf42517b1c1bb7f09a854e9dda
5
5
  SHA512:
6
- metadata.gz: 4b04956edc2501af9b15ab09af37acbe105bf9c425d6135c3c463f56624828b1d16da77dc4e051d39f6418414149d0d5a1f85fa86d315ee0ae54f1d9a2f14989
7
- data.tar.gz: 261ee52bf70ee9d0158e3d7106cea31b72b296d481e0f2bfa349bee32c23a09f566943f83733b1f656ae3cd45aa00785de24fc3335d4398c7e14ec789088d553
6
+ metadata.gz: fc9e29b56a5ad7904ffc6fc802fbb4bc87a0ddb19c2e51a7fd3abc491e53112769dda9e00370a970a6a220bde816cd0d17a0f4b7cafc4616ea14770173d6d7ac
7
+ data.tar.gz: d0774dde0d1ac8c48d55a90c6ee7b658467b3ed97f451c1f2e21a966f1c6d68305a923d6259dd0ccaee684f3a529b080fbcc77c2fddcbc2950035d54c1bd81da
data/chef-cli.gemspec CHANGED
@@ -47,7 +47,7 @@ Gem::Specification.new do |gem|
47
47
  gem.add_dependency "solve", "< 5.0", "> 2.0"
48
48
  gem.add_dependency "addressable", ">= 2.3.5", "< 2.9"
49
49
  gem.add_dependency "cookbook-omnifetch", "~> 0.5"
50
- gem.add_dependency "diff-lcs", ">= 1.0", "< 1.4" # 1.4 changes the output
50
+ gem.add_dependency "diff-lcs", ">= 1.2.4", "!= 1.4.0", "< 1.6.0" # 1.4 breaks output. Used in lib/chef/util/diff
51
51
  gem.add_dependency "pastel", "~> 0.7" # used for policyfile differ
52
52
  gem.add_dependency "license-acceptance", ">= 1.0.11", "< 3"
53
53
  end
@@ -43,7 +43,7 @@ module ChefCLI
43
43
  raise LockfileNotFound, "Expected lockfile at #{policyfile_lock_relpath} does not exist" unless File.exist?(policyfile_lock_relpath)
44
44
  raise LockfileNotFound, "Expected lockfile at #{policyfile_lock_relpath} cannot be read" unless File.readable?(policyfile_lock_relpath)
45
45
 
46
- FFI_Yajl::Parser.parse(IO.read(policyfile_lock_relpath))
46
+ FFI_Yajl::Parser.parse(File.read(policyfile_lock_relpath))
47
47
  rescue FFI_Yajl::ParseError => e
48
48
  raise MalformedLockfile, "Invalid JSON in lockfile at #{policyfile_lock_relpath}:\n #{e.message}"
49
49
  end
@@ -102,7 +102,7 @@ module ChefCLI
102
102
  end
103
103
 
104
104
  def content
105
- IO.read(path)
105
+ File.read(path)
106
106
  end
107
107
 
108
108
  def path
@@ -109,7 +109,7 @@ module ChefCLI
109
109
  end
110
110
 
111
111
  def load_undo_record(file)
112
- data = FFI_Yajl::Parser.parse(IO.read(file))
112
+ data = FFI_Yajl::Parser.parse(File.read(file))
113
113
  UndoRecord.new.load(data)
114
114
  end
115
115
 
@@ -64,7 +64,7 @@ module ChefCLI
64
64
  end
65
65
  end
66
66
 
67
- RUN_LIST_ITEM_FORMAT = /\Arecipe\[[^\s]+::[^\s]+\]\Z/
67
+ RUN_LIST_ITEM_FORMAT = /\Arecipe\[([^:\s][^:\s]{0,254})::([^:\s][^:\s]{0,254})\]\Z/
68
68
 
69
69
  def self.build(storage_config)
70
70
  lock = new(storage_config)
@@ -78,7 +78,7 @@ module ChefCLI
78
78
  end
79
79
 
80
80
  def policy_data
81
- @policy_data ||= FFI_Yajl::Parser.parse(IO.read(policyfile_lock_expanded_path))
81
+ @policy_data ||= FFI_Yajl::Parser.parse(File.read(policyfile_lock_expanded_path))
82
82
  rescue => error
83
83
  raise PolicyfileExportRepoError.new("Error reading lockfile #{policyfile_lock_expanded_path}", error)
84
84
  end
@@ -69,7 +69,7 @@ module ChefCLI
69
69
  end
70
70
 
71
71
  def policyfile_content
72
- @policyfile_content ||= IO.read(policyfile_expanded_path)
72
+ @policyfile_content ||= File.read(policyfile_expanded_path)
73
73
  end
74
74
 
75
75
  def policyfile_compiler
@@ -81,7 +81,7 @@ module ChefCLI
81
81
  end
82
82
 
83
83
  def policyfile_lock_content
84
- @policyfile_lock_content ||= IO.read(policyfile_lock_expanded_path) if File.exist?(policyfile_lock_expanded_path)
84
+ @policyfile_lock_content ||= File.read(policyfile_lock_expanded_path) if File.exist?(policyfile_lock_expanded_path)
85
85
  end
86
86
 
87
87
  def policyfile_lock
@@ -57,7 +57,7 @@ module ChefCLI
57
57
  end
58
58
 
59
59
  def policy_data
60
- @policy_data ||= FFI_Yajl::Parser.parse(IO.read(policyfile_lock_expanded_path))
60
+ @policy_data ||= FFI_Yajl::Parser.parse(File.read(policyfile_lock_expanded_path))
61
61
  rescue => error
62
62
  raise PolicyfilePushError.new("Error reading lockfile #{policyfile_lock_expanded_path}", error)
63
63
  end
@@ -120,7 +120,7 @@ module ChefCLI
120
120
  end
121
121
 
122
122
  def load_policy_data(policyfile_lock_path)
123
- FFI_Yajl::Parser.parse(IO.read(policyfile_lock_path))
123
+ FFI_Yajl::Parser.parse(File.read(policyfile_lock_path))
124
124
  end
125
125
 
126
126
  def stage_unpacked_archive
@@ -74,7 +74,7 @@ module ChefCLI
74
74
  end
75
75
 
76
76
  def policyfile_content
77
- @policyfile_content ||= IO.read(policyfile_expanded_path)
77
+ @policyfile_content ||= File.read(policyfile_expanded_path)
78
78
  end
79
79
 
80
80
  def policyfile_compiler
@@ -82,7 +82,7 @@ module ChefCLI
82
82
  end
83
83
 
84
84
  def policyfile_lock_content
85
- @policyfile_lock_content ||= IO.read(policyfile_lock_expanded_path)
85
+ @policyfile_lock_content ||= File.read(policyfile_lock_expanded_path)
86
86
  end
87
87
 
88
88
  def policyfile_lock
@@ -13,7 +13,7 @@ end
13
13
  if context.content_source
14
14
 
15
15
  file cookbook_file_path do
16
- content(IO.read(context.content_source))
16
+ content(File.read(context.content_source))
17
17
  end
18
18
 
19
19
  else
@@ -18,7 +18,7 @@ end
18
18
  if context.content_source
19
19
 
20
20
  file template_path do
21
- content(IO.read(context.content_source))
21
+ content(File.read(context.content_source))
22
22
  end
23
23
 
24
24
  else
@@ -30,7 +30,6 @@ platforms:
30
30
  - name: centos-stream-9
31
31
  - name: debian-12
32
32
  - name: fedora-latest
33
- - name: freebsd-14
34
33
  - name: opensuse-leap-15
35
34
  - name: oraclelinux-9
36
35
  - name: rockylinux-9
@@ -26,7 +26,6 @@ platforms:
26
26
  - name: centos-stream-9
27
27
  - name: debian-12
28
28
  - name: fedora-latest
29
- - name: freebsd-14
30
29
  - name: opensuse-leap-15
31
30
  - name: oraclelinux-9
32
31
  - name: rockylinux-9
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefCLI
19
- VERSION = "5.6.16".freeze
19
+ VERSION = "5.6.20".freeze
20
20
  end
@@ -107,7 +107,7 @@ shared_examples_for "custom generator cookbook" do
107
107
  FileUtils.cp_r(default_generator_cookbook_path, generator_cookbook_path)
108
108
 
109
109
  # have to update metadata with the correct name
110
- IO.binwrite(metadata_file, "name 'a_generator_cookbook'")
110
+ File.binwrite(metadata_file, "name 'a_generator_cookbook'")
111
111
  end
112
112
 
113
113
  it "creates the new files" do
@@ -292,7 +292,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
292
292
  let(:file) { File.join(tempdir, "new_cookbook", "kitchen.yml") }
293
293
 
294
294
  it "creates a kitchen.yml with the expected content" do
295
- expect(IO.read(file)).to eq(expected_kitchen_yml_content)
295
+ expect(File.read(file)).to eq(expected_kitchen_yml_content)
296
296
  end
297
297
 
298
298
  end
@@ -323,7 +323,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
323
323
  let(:file) { File.join(tempdir, "new_cookbook", "spec", "spec_helper.rb") }
324
324
 
325
325
  it "creates a spec/spec_helper.rb for ChefSpec with the expected content" do
326
- expect(IO.read(file)).to eq(expected_chefspec_spec_helper_content)
326
+ expect(File.read(file)).to eq(expected_chefspec_spec_helper_content)
327
327
  end
328
328
 
329
329
  end
@@ -367,7 +367,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
367
367
  end
368
368
 
369
369
  it "has a run_list and cookbook path that will work out of the box" do
370
- expect(IO.read(file)).to eq(expected_content)
370
+ expect(File.read(file)).to eq(expected_content)
371
371
  end
372
372
 
373
373
  end
@@ -404,7 +404,6 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
404
404
  - name: centos-stream-9
405
405
  - name: debian-12
406
406
  - name: fedora-latest
407
- - name: freebsd-14
408
407
  - name: opensuse-leap-15
409
408
  - name: oraclelinux-9
410
409
  - name: rockylinux-9
@@ -475,8 +474,8 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
475
474
  end
476
475
 
477
476
  it "has a default.yml file with template contents" do
478
- expect(IO.read(file)).to match(expected_content_header)
479
- expect(IO.read(file)).to match(expected_content)
477
+ expect(File.read(file)).to match(expected_content_header)
478
+ expect(File.read(file)).to match(expected_content)
480
479
  end
481
480
 
482
481
  end
@@ -507,7 +506,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
507
506
  end
508
507
 
509
508
  it "pulls deps from metadata" do
510
- expect(IO.read(file)).to eq(expected_content)
509
+ expect(File.read(file)).to eq(expected_content)
511
510
  end
512
511
 
513
512
  end
@@ -548,7 +547,6 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
548
547
  - name: centos-stream-9
549
548
  - name: debian-12
550
549
  - name: fedora-latest
551
- - name: freebsd-14
552
550
  - name: opensuse-leap-15
553
551
  - name: oraclelinux-9
554
552
  - name: rockylinux-9
@@ -179,7 +179,7 @@ describe ChefCLI::Command::GeneratorCommands::GeneratorGenerator do
179
179
  generator_generator.run
180
180
 
181
181
  metadata_path = File.join(target_dir, "metadata.rb")
182
- metadata_content = IO.read(metadata_path)
182
+ metadata_content = File.read(metadata_path)
183
183
  expected_metadata = <<~METADATA
184
184
  name File.basename(File.dirname(__FILE__))
185
185
  description 'Custom code generator cookbook for use with #{ChefCLI::Dist::PRODUCT}'
@@ -174,7 +174,7 @@ describe ChefCLI::Command::GeneratorCommands::Policyfile do
174
174
  end
175
175
 
176
176
  it "adds chef_repo as a default source and uses argv for the policy name" do
177
- expect(IO.read(expected_policyfile_path)).to eq(expected_policyfile_content)
177
+ expect(File.read(expected_policyfile_path)).to eq(expected_policyfile_content)
178
178
  end
179
179
 
180
180
  end
@@ -200,7 +200,7 @@ describe ChefCLI::Command::GeneratorCommands::Policyfile do
200
200
  end
201
201
 
202
202
  it "adds chef_repo as a default source" do
203
- expect(IO.read(expected_policyfile_path)).to eq(expected_policyfile_content)
203
+ expect(File.read(expected_policyfile_path)).to eq(expected_policyfile_content)
204
204
  end
205
205
 
206
206
  end
@@ -27,9 +27,9 @@ describe ChefCLI::Policyfile::ArtifactoryCookbookSource do
27
27
 
28
28
  let(:http_connection) { double("Chef::HTTP::Simple") }
29
29
 
30
- let(:universe_response_encoded) { IO.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
30
+ let(:universe_response_encoded) { File.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
31
31
 
32
- let(:pruned_universe) { JSON.parse(IO.read(File.join(fixtures_path, "cookbooks_api/pruned_small_universe.json"))) }
32
+ let(:pruned_universe) { JSON.parse(File.read(File.join(fixtures_path, "cookbooks_api/pruned_small_universe.json"))) }
33
33
 
34
34
  describe "fetching the Universe graph" do
35
35
 
@@ -25,9 +25,9 @@ describe ChefCLI::Policyfile::ChefServerCookbookSource do
25
25
 
26
26
  let(:http_connection) { double("Chef::ServerAPI") }
27
27
 
28
- let(:universe_response_encoded) { JSON.parse(IO.read(File.join(fixtures_path, "cookbooks_api/chef_server_universe.json"))) }
28
+ let(:universe_response_encoded) { JSON.parse(File.read(File.join(fixtures_path, "cookbooks_api/chef_server_universe.json"))) }
29
29
 
30
- let(:pruned_universe) { JSON.parse(IO.read(File.join(fixtures_path, "cookbooks_api/pruned_chef_server_universe.json"))) }
30
+ let(:pruned_universe) { JSON.parse(File.read(File.join(fixtures_path, "cookbooks_api/pruned_chef_server_universe.json"))) }
31
31
 
32
32
  describe "fetching the Universe graph" do
33
33
 
@@ -26,9 +26,9 @@ describe ChefCLI::Policyfile::CommunityCookbookSource do
26
26
 
27
27
  let(:http_connection) { double("Chef::HTTP::Simple") }
28
28
 
29
- let(:universe_response_encoded) { IO.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
29
+ let(:universe_response_encoded) { File.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
30
30
 
31
- let(:pruned_universe) { JSON.parse(IO.read(File.join(fixtures_path, "cookbooks_api/pruned_small_universe.json"))) }
31
+ let(:pruned_universe) { JSON.parse(File.read(File.join(fixtures_path, "cookbooks_api/pruned_small_universe.json"))) }
32
32
 
33
33
  it "defaults to using the public supermarket over HTTPS" do
34
34
  expect(cookbook_source.uri).to eq(default_community_uri)
@@ -26,7 +26,7 @@ describe ChefCLI::Policyfile::DeliverySupermarketSource do
26
26
 
27
27
  let(:http_connection) { double("Chef::HTTP::Simple") }
28
28
 
29
- let(:universe_response_encoded) { IO.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
29
+ let(:universe_response_encoded) { File.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
30
30
 
31
31
  let(:truncated_universe) do
32
32
  {
@@ -318,7 +318,7 @@ describe ChefCLI::Policyfile::Differ do
318
318
  REVISION ID CHANGED
319
319
  ===================
320
320
 
321
- @@ -1,2 +1,2 @@
321
+ @@ -1 +1 @@
322
322
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
323
323
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
324
324
 
@@ -369,7 +369,7 @@ describe ChefCLI::Policyfile::Differ do
369
369
  REVISION ID CHANGED
370
370
  ===================
371
371
 
372
- @@ -1,2 +1,2 @@
372
+ @@ -1 +1 @@
373
373
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
374
374
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
375
375
 
@@ -428,7 +428,7 @@ describe ChefCLI::Policyfile::Differ do
428
428
  REVISION ID CHANGED
429
429
  ===================
430
430
 
431
- @@ -1,2 +1,2 @@
431
+ @@ -1 +1 @@
432
432
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
433
433
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
434
434
 
@@ -501,7 +501,7 @@ describe ChefCLI::Policyfile::Differ do
501
501
  REVISION ID CHANGED
502
502
  ===================
503
503
 
504
- @@ -1,2 +1,2 @@
504
+ @@ -1 +1 @@
505
505
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
506
506
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
507
507
 
@@ -511,7 +511,7 @@ describe ChefCLI::Policyfile::Differ do
511
511
  bluepill
512
512
  --------
513
513
 
514
- @@ -1 +1,12 @@
514
+ @@ -1,11 +1,22 @@
515
515
  +{
516
516
  + "version": "2.3.2",
517
517
  + "identifier": "9c6990944d9a347dec8bd375e707ba0aecdc17cd",
@@ -563,7 +563,7 @@ describe ChefCLI::Policyfile::Differ do
563
563
  REVISION ID CHANGED
564
564
  ===================
565
565
 
566
- @@ -1,2 +1,2 @@
566
+ @@ -1 +1 @@
567
567
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
568
568
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
569
569
 
@@ -616,7 +616,7 @@ describe ChefCLI::Policyfile::Differ do
616
616
  REVISION ID CHANGED
617
617
  ===================
618
618
 
619
- @@ -1,2 +1,2 @@
619
+ @@ -1 +1 @@
620
620
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
621
621
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
622
622
 
@@ -662,7 +662,7 @@ describe ChefCLI::Policyfile::Differ do
662
662
  REVISION ID CHANGED
663
663
  ===================
664
664
 
665
- @@ -1,2 +1,2 @@
665
+ @@ -1 +1 @@
666
666
  -cf4b8a020bdc1ba6914093a8a07a5514cce8a3a2979a967b1f32ea704a61785b
667
667
  +304566f86a620aae85797a3c491a51fb8c6ecf996407e77b8063aa3ee59672c5
668
668
 
@@ -97,7 +97,7 @@ describe ChefCLI::Policyfile::UndoStack do
97
97
  it "creates the undo record" do
98
98
  expect(undo_stack_files.size).to eq(1)
99
99
 
100
- undo_record_json = IO.read(undo_stack_files.first)
100
+ undo_record_json = File.read(undo_stack_files.first)
101
101
  undo_record_data = FFI_Yajl::Parser.parse(undo_record_json)
102
102
  expect(undo_record_data).to eq(undo_record.for_serialization)
103
103
  end
@@ -867,6 +867,24 @@ describe ChefCLI::PolicyfileLock, "building a lockfile", :skip_on_windows do
867
867
 
868
868
  end
869
869
 
870
+ context "with invalid run list items" do
871
+ it "detects invalid format in run list items with extra colons" do
872
+ expect("recipe[cookbook:default::invalid]").not_to match(ChefCLI::PolicyfileLock::RUN_LIST_ITEM_FORMAT)
873
+ end
874
+
875
+ it "detects invalid format when a run list item has no cookbook name" do
876
+ expect("recipe[::recipe_name]").not_to match(ChefCLI::PolicyfileLock::RUN_LIST_ITEM_FORMAT)
877
+ end
878
+
879
+ it "detects invalid format when a run list item has no recipe name" do
880
+ expect("recipe[cookbook::]").not_to match(ChefCLI::PolicyfileLock::RUN_LIST_ITEM_FORMAT)
881
+ end
882
+
883
+ it "validates proper recipe format correctly" do
884
+ expect("recipe[cookbook::recipe_name]").to match(ChefCLI::PolicyfileLock::RUN_LIST_ITEM_FORMAT)
885
+ end
886
+ end
887
+
870
888
  describe "building a policyfile lock from a policyfile compiler" do
871
889
 
872
890
  include_context "setup git cookbooks"
@@ -124,7 +124,7 @@ describe ChefCLI::PolicyfileLock, "validating locked cookbooks" do
124
124
  version '2.3.4'
125
125
 
126
126
  E
127
- expect(IO.read(metadata_path)).to eq(expected_metadata_rb)
127
+ expect(File.read(metadata_path)).to eq(expected_metadata_rb)
128
128
  end
129
129
 
130
130
  context "when the cookbook is missing" do
@@ -551,7 +551,7 @@ describe ChefCLI::PolicyfileLock, "validating locked cookbooks" do
551
551
  version '1.0.0'
552
552
 
553
553
  E
554
- expect(IO.read(metadata_path)).to eq(expected_metadata_rb)
554
+ expect(File.read(metadata_path)).to eq(expected_metadata_rb)
555
555
  end
556
556
 
557
557
  context "when the cookbook missing" do
@@ -239,19 +239,19 @@ describe ChefCLI::PolicyfileServices::ExportRepo do
239
239
  # shell out to git for the version number, etc.
240
240
  it "writes metadata.json in the exported cookbook, removing metadata.rb" do
241
241
  metadata_json_path = File.join(exported_cookbook_root, "metadata.json")
242
- metadata_json = FFI_Yajl::Parser.parse(IO.read(metadata_json_path))
242
+ metadata_json = FFI_Yajl::Parser.parse(File.read(metadata_json_path))
243
243
  expect(metadata_json["version"]).to eq("2.3.4")
244
244
  end
245
245
 
246
246
  it "copies the policyfile lock to policies/POLICY_NAME.json" do
247
247
  exported_policy_path = File.join(export_dir, "policies", "install-example-#{revision_id}.json")
248
- exported_policy_json = IO.read(exported_policy_path)
248
+ exported_policy_json = File.read(exported_policy_path)
249
249
  expect(exported_policy_json).to eq(FFI_Yajl::Encoder.encode(export_service.policyfile_lock.to_lock, pretty: true))
250
250
  end
251
251
 
252
252
  it "creates a policy_group file for the local policy group with the revision id of the exported policy" do
253
253
  exported_policy_group_path = File.join(export_dir, "policy_groups", "local.json")
254
- exported_policy_group_data = FFI_Yajl::Parser.parse(IO.read(exported_policy_group_path))
254
+ exported_policy_group_data = FFI_Yajl::Parser.parse(File.read(exported_policy_group_path))
255
255
 
256
256
  expected_data = { "policies" => { "install-example" => { "revision_id" => revision_id } } }
257
257
 
@@ -260,7 +260,7 @@ describe ChefCLI::PolicyfileServices::ExportRepo do
260
260
 
261
261
  it "copies the policyfile lock in standard format to Policyfile.lock.json" do
262
262
  policyfile_lock_path = File.join(export_dir, "Policyfile.lock.json")
263
- policyfile_lock_data = FFI_Yajl::Parser.parse(IO.read(policyfile_lock_path))
263
+ policyfile_lock_data = FFI_Yajl::Parser.parse(File.read(policyfile_lock_path))
264
264
  expected_lock_data = export_service.policyfile_lock.to_lock
265
265
 
266
266
  # stringify keys in source_options
@@ -301,7 +301,7 @@ describe ChefCLI::PolicyfileServices::ExportRepo do
301
301
  CONFIG
302
302
  config_path = File.join(export_dir, ".chef", "config.rb")
303
303
  expect(File).to exist(config_path)
304
- expect(IO.read(config_path)).to eq(expected_config_text)
304
+ expect(File.read(config_path)).to eq(expected_config_text)
305
305
  end
306
306
 
307
307
  it "generates a README.md in the exported repo" do
@@ -313,7 +313,7 @@ describe ChefCLI::PolicyfileServices::ExportRepo do
313
313
  let(:policy_group) { "production" }
314
314
  it "creates a policy_group file for a specified policy group with the revision id of the exported policy" do
315
315
  exported_policy_group_path = File.join(export_dir, "policy_groups", "production.json")
316
- exported_policy_group_data = FFI_Yajl::Parser.parse(IO.read(exported_policy_group_path))
316
+ exported_policy_group_data = FFI_Yajl::Parser.parse(File.read(exported_policy_group_path))
317
317
 
318
318
  expected_data = { "policies" => { "install-example" => { "revision_id" => revision_id } } }
319
319
 
@@ -351,7 +351,7 @@ describe ChefCLI::PolicyfileServices::ExportRepo do
351
351
  CONFIG
352
352
  config_path = File.join(export_dir, ".chef", "config.rb")
353
353
  expect(File).to exist(config_path)
354
- expect(IO.read(config_path)).to eq(expected_config_text)
354
+ expect(File.read(config_path)).to eq(expected_config_text)
355
355
  end
356
356
  end
357
357
 
@@ -68,7 +68,7 @@ describe ChefCLI::PolicyfileServices::Install do
68
68
 
69
69
  def result_policyfile_lock
70
70
  expect(File).to exist(policyfile_lock_path)
71
- content = IO.read(policyfile_lock_path)
71
+ content = File.read(policyfile_lock_path)
72
72
  lock_data = FFI_Yajl::Parser.parse(content)
73
73
  ChefCLI::PolicyfileLock.new(storage_config).build_from_lock_data(lock_data)
74
74
  end
@@ -151,7 +151,7 @@ describe ChefCLI::PolicyfileServices::UpdateAttributes do
151
151
 
152
152
  def result_policyfile_lock_data
153
153
  expect(File).to exist(policyfile_lock_path)
154
- content = IO.read(policyfile_lock_path)
154
+ content = File.read(policyfile_lock_path)
155
155
  FFI_Yajl::Parser.parse(content)
156
156
  end
157
157
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.16
4
+ version: 5.6.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-06 00:00:00.000000000 Z
11
+ date: 2025-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-cli
@@ -158,20 +158,26 @@ dependencies:
158
158
  requirements:
159
159
  - - ">="
160
160
  - !ruby/object:Gem::Version
161
- version: '1.0'
161
+ version: 1.2.4
162
+ - - "!="
163
+ - !ruby/object:Gem::Version
164
+ version: 1.4.0
162
165
  - - "<"
163
166
  - !ruby/object:Gem::Version
164
- version: '1.4'
167
+ version: 1.6.0
165
168
  type: :runtime
166
169
  prerelease: false
167
170
  version_requirements: !ruby/object:Gem::Requirement
168
171
  requirements:
169
172
  - - ">="
170
173
  - !ruby/object:Gem::Version
171
- version: '1.0'
174
+ version: 1.2.4
175
+ - - "!="
176
+ - !ruby/object:Gem::Version
177
+ version: 1.4.0
172
178
  - - "<"
173
179
  - !ruby/object:Gem::Version
174
- version: '1.4'
180
+ version: 1.6.0
175
181
  - !ruby/object:Gem::Dependency
176
182
  name: pastel
177
183
  requirement: !ruby/object:Gem::Requirement
@@ -614,7 +620,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
614
620
  - !ruby/object:Gem::Version
615
621
  version: '0'
616
622
  requirements: []
617
- rubygems_version: 3.2.3
623
+ rubygems_version: 3.3.27
618
624
  signing_key:
619
625
  specification_version: 4
620
626
  summary: A streamlined development and deployment workflow for Chef platform.