chef-cli 5.6.18 → 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.
- checksums.yaml +4 -4
 - data/lib/chef-cli/policyfile/comparison_base.rb +1 -1
 - data/lib/chef-cli/policyfile/local_lock_fetcher.rb +1 -1
 - data/lib/chef-cli/policyfile/undo_stack.rb +1 -1
 - data/lib/chef-cli/policyfile_lock.rb +1 -1
 - data/lib/chef-cli/policyfile_services/export_repo.rb +1 -1
 - data/lib/chef-cli/policyfile_services/install.rb +2 -2
 - data/lib/chef-cli/policyfile_services/push.rb +1 -1
 - data/lib/chef-cli/policyfile_services/push_archive.rb +1 -1
 - data/lib/chef-cli/policyfile_services/update_attributes.rb +2 -2
 - data/lib/chef-cli/skeletons/code_generator/recipes/cookbook_file.rb +1 -1
 - data/lib/chef-cli/skeletons/code_generator/recipes/template.rb +1 -1
 - data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen.yml.erb +0 -1
 - data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +0 -1
 - data/lib/chef-cli/version.rb +1 -1
 - data/spec/shared/custom_generator_cookbook.rb +1 -1
 - data/spec/unit/command/generator_commands/cookbook_spec.rb +6 -8
 - data/spec/unit/command/generator_commands/generator_generator_spec.rb +1 -1
 - data/spec/unit/command/generator_commands/policyfile_spec.rb +2 -2
 - data/spec/unit/policyfile/artifactory_cookbook_source_spec.rb +2 -2
 - data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +2 -2
 - data/spec/unit/policyfile/community_cookbook_source_spec.rb +2 -2
 - data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +1 -1
 - data/spec/unit/policyfile/undo_stack_spec.rb +1 -1
 - data/spec/unit/policyfile_lock_build_spec.rb +18 -0
 - data/spec/unit/policyfile_lock_validation_spec.rb +2 -2
 - data/spec/unit/policyfile_services/export_repo_spec.rb +7 -7
 - data/spec/unit/policyfile_services/install_spec.rb +1 -1
 - data/spec/unit/policyfile_services/update_attributes_spec.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f219b019dc29d8ccf36df3de27450d1353ce9afc04b88c99c1700b9f828725ab
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a0230c8cde5ba86ce76b8d347bd700cf24b75faf42517b1c1bb7f09a854e9dda
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fc9e29b56a5ad7904ffc6fc802fbb4bc87a0ddb19c2e51a7fd3abc491e53112769dda9e00370a970a6a220bde816cd0d17a0f4b7cafc4616ea14770173d6d7ac
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d0774dde0d1ac8c48d55a90c6ee7b658467b3ed97f451c1f2e21a966f1c6d68305a923d6259dd0ccaee684f3a529b080fbcc77c2fddcbc2950035d54c1bd81da
         
     | 
| 
         @@ -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( 
     | 
| 
      
 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
         
     | 
| 
         @@ -78,7 +78,7 @@ module ChefCLI 
     | 
|
| 
       78 
78 
     | 
    
         
             
                  end
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
80 
     | 
    
         
             
                  def policy_data
         
     | 
| 
       81 
     | 
    
         
            -
                    @policy_data ||= FFI_Yajl::Parser.parse( 
     | 
| 
      
 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 ||=  
     | 
| 
      
 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 ||=  
     | 
| 
      
 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( 
     | 
| 
      
 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
         
     | 
| 
         @@ -74,7 +74,7 @@ module ChefCLI 
     | 
|
| 
       74 
74 
     | 
    
         
             
                  end
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
                  def policyfile_content
         
     | 
| 
       77 
     | 
    
         
            -
                    @policyfile_content ||=  
     | 
| 
      
 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 ||=  
     | 
| 
      
 85 
     | 
    
         
            +
                    @policyfile_lock_content ||= File.read(policyfile_lock_expanded_path)
         
     | 
| 
       86 
86 
     | 
    
         
             
                  end
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
       88 
88 
     | 
    
         
             
                  def policyfile_lock
         
     | 
    
        data/lib/chef-cli/version.rb
    CHANGED
    
    
| 
         @@ -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 
     | 
    
         
            -
                     
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
       479 
     | 
    
         
            -
                      expect( 
     | 
| 
      
 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( 
     | 
| 
      
 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 =  
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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) {  
     | 
| 
      
 30 
     | 
    
         
            +
              let(:universe_response_encoded) { File.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
              let(:pruned_universe) { JSON.parse( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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) {  
     | 
| 
      
 29 
     | 
    
         
            +
              let(:universe_response_encoded) { File.read(File.join(fixtures_path, "cookbooks_api/small_universe.json")) }
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
              let(:pruned_universe) { JSON.parse( 
     | 
| 
      
 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) {  
     | 
| 
      
 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 
     | 
    
         
             
                {
         
     | 
| 
         @@ -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 =  
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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 =  
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
      
 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 =  
     | 
| 
      
 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 =  
     | 
| 
      
 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. 
     | 
| 
      
 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: 2025- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-05-09 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: mixlib-cli
         
     | 
| 
         @@ -620,7 +620,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       620 
620 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       621 
621 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       622 
622 
     | 
    
         
             
            requirements: []
         
     | 
| 
       623 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 623 
     | 
    
         
            +
            rubygems_version: 3.3.27
         
     | 
| 
       624 
624 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       625 
625 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       626 
626 
     | 
    
         
             
            summary: A streamlined development and deployment workflow for Chef platform.
         
     |