diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-10-30 19:57:12 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-10-30 19:57:12 -0700 |
commit | a114046532e8c9576ec185b9fba071a28bab0b3d (patch) | |
tree | 37cd9872cfb17063d926382eadfeca56b3e223ae | |
parent | 9e399e297aec16f46e40b3cb361ed625067642b5 (diff) | |
download | chef-lcg/chef-15-cleanup-cookbook-loader.tar.gz |
more removal of cookbook shadowing/merginglcg/chef-15-cleanup-cookbook-loader
we no longer support reading cookbooks from multiple cookbook paths.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 7 | ||||
-rw-r--r-- | spec/unit/cookbook/cookbook_version_loader_spec.rb | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index ea0b9d2b08..96bc4aa303 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -22,7 +22,6 @@ class Chef UPLOADED_COOKBOOK_VERSION_FILE = ".uploaded-cookbook-version.json".freeze attr_reader :cookbook_settings - attr_reader :cookbook_paths attr_reader :frozen attr_reader :uploaded_cookbook_version_file @@ -35,8 +34,6 @@ class Chef def initialize(path, chefignore = nil) @cookbook_path = File.expand_path( path ) # cookbook_path from which this was loaded - # We keep a list of all cookbook paths that have been merged in - @cookbook_paths = [ cookbook_path ] @inferred_cookbook_name = File.basename( path ) @chefignore = chefignore @@ -86,7 +83,7 @@ class Chef def cookbook_version return nil if empty? - Chef::CookbookVersion.new(cookbook_name, *cookbook_paths).tap do |c| + Chef::CookbookVersion.new(cookbook_name, cookbook_path).tap do |c| c.all_files = cookbook_settings[:all_files].values c.metadata = metadata @@ -164,7 +161,7 @@ class Chef # actually empty, a metadata error here would be misleading, so don't # raise it (if called by #load!, a different error is raised). if !empty? && !metadata.valid? - message = "Cookbook loaded at path(s) [#{cookbook_paths.join(', ')}] has invalid metadata: #{metadata.errors.join('; ')}" + message = "Cookbook loaded at path [#{cookbook_path}] has invalid metadata: #{metadata.errors.join('; ')}" raise Exceptions::MetadataNotValid, message end false diff --git a/spec/unit/cookbook/cookbook_version_loader_spec.rb b/spec/unit/cookbook/cookbook_version_loader_spec.rb index 40a054abee..c38af059f5 100644 --- a/spec/unit/cookbook/cookbook_version_loader_spec.rb +++ b/spec/unit/cookbook/cookbook_version_loader_spec.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2014-2016, Chef Software, Inc. +# Copyright:: Copyright 2014-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -173,7 +173,7 @@ describe Chef::Cookbook::CookbookVersionLoader do let(:cookbook_path) { File.join(CHEF_SPEC_DATA, "incomplete-metadata-chef-repo/incomplete-metadata") } let(:error_message) do - "Cookbook loaded at path(s) [#{cookbook_path}] has invalid metadata: The `name' attribute is required in cookbook metadata" + "Cookbook loaded at path [#{cookbook_path}] has invalid metadata: The `name' attribute is required in cookbook metadata" end it "raises an error when loading with #load!" do |