diff options
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 3 | ||||
-rw-r--r-- | lib/chef/cookbook/file_system_file_vendor.rb | 1 | ||||
-rw-r--r-- | lib/chef/cookbook/file_vendor.rb | 1 | ||||
-rw-r--r-- | lib/chef/cookbook/gem_installer.rb | 1 | ||||
-rw-r--r-- | lib/chef/cookbook/manifest_v0.rb | 1 | ||||
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook/remote_file_vendor.rb | 1 | ||||
-rw-r--r-- | lib/chef/cookbook/synchronizer.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook/syntax_check.rb | 4 |
9 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index ad7ee3b1c2..6d1b3e1f61 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -70,6 +70,7 @@ class Chef if empty? raise Exceptions::CookbookNotFoundInRepo, "The directory #{cookbook_path} does not contain a cookbook" end + file_paths_map end @@ -152,6 +153,7 @@ class Chef def metadata_filenames return @metadata_filenames unless @metadata_filenames.empty? + if File.exists?(File.join(cookbook_path, UPLOADED_COOKBOOK_VERSION_FILE)) @uploaded_cookbook_version_file = File.join(cookbook_path, UPLOADED_COOKBOOK_VERSION_FILE) end @@ -171,6 +173,7 @@ class Chef def raise_metadata_error! raise metadata_error unless metadata_error.nil? + # Metadata won't be valid if the cookbook is empty. If the cookbook is # actually empty, a metadata error here would be misleading, so don't # raise it (if called by #load!, a different error is raised). diff --git a/lib/chef/cookbook/file_system_file_vendor.rb b/lib/chef/cookbook/file_system_file_vendor.rb index 2faeb31815..b89d10cd48 100644 --- a/lib/chef/cookbook/file_system_file_vendor.rb +++ b/lib/chef/cookbook/file_system_file_vendor.rb @@ -49,6 +49,7 @@ class Chef def get_filename(filename) location = File.join(cookbooks[cookbook_name].root_dir, filename) if cookbooks.key?(cookbook_name) raise "File #{filename} does not exist for cookbook #{cookbook_name}" unless location && File.exist?(location) + location end diff --git a/lib/chef/cookbook/file_vendor.rb b/lib/chef/cookbook/file_vendor.rb index 60948cc3a5..82eb4e03f6 100644 --- a/lib/chef/cookbook/file_vendor.rb +++ b/lib/chef/cookbook/file_vendor.rb @@ -54,6 +54,7 @@ class Chef if @vendor_class.nil? raise "Must configure FileVendor to use a specific implementation before creating an instance" end + @vendor_class.new(manifest, @initialization_options) end diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb index bd1d0fb93a..eab4b47241 100644 --- a/lib/chef/cookbook/gem_installer.rb +++ b/lib/chef/cookbook/gem_installer.rb @@ -43,6 +43,7 @@ class Chef args << {} unless args.last.is_a?(Hash) args.last.merge!(cookbook_gems[args.first].pop) do |key, v1, v2| raise Chef::Exceptions::GemRequirementConflict.new(args.first, key, v1, v2) if v1 != v2 + v2 end end diff --git a/lib/chef/cookbook/manifest_v0.rb b/lib/chef/cookbook/manifest_v0.rb index e285b29fd2..a4c60e5827 100644 --- a/lib/chef/cookbook/manifest_v0.rb +++ b/lib/chef/cookbook/manifest_v0.rb @@ -32,6 +32,7 @@ class Chef response = Mash.new(hash) response[:all_files] = COOKBOOK_SEGMENTS.inject([]) do |memo, segment| next memo if hash[segment].nil? || hash[segment].empty? + hash[segment].each do |file| file["name"] = "#{segment}/#{file["name"]}" memo << file diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 6d82ae4e30..ff12d865c3 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -286,6 +286,7 @@ class Chef constraint = validate_version_constraint(:depends, cookbook, version) @dependencies[cookbook] = constraint.to_s end + @dependencies[cookbook] end @@ -583,6 +584,7 @@ class Chef def gem_dep_matches?(what, version, *deps) # always match if we have no chef_version at all return true unless deps.length > 0 + # match if we match any of the chef_version lines deps.any? { |dep| dep.match?(what, version) } end diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb index 9ccb2ff46c..ebdb94ee54 100644 --- a/lib/chef/cookbook/remote_file_vendor.rb +++ b/lib/chef/cookbook/remote_file_vendor.rb @@ -44,6 +44,7 @@ class Chef end raise "No such segment #{segment} in cookbook #{@cookbook_name}" unless @manifest.files_for(segment) + found_manifest_record = @manifest.files_for(segment).find { |manifest_record| manifest_record[:path] == filename } raise "No such file #{filename} in #{@cookbook_name}" unless found_manifest_record diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb index 8c87ababb6..b69e6b8212 100644 --- a/lib/chef/cookbook/synchronizer.rb +++ b/lib/chef/cookbook/synchronizer.rb @@ -223,6 +223,7 @@ class Chef cache.find(File.join(%w{cookbooks ** {*,.*}})).each do |cache_file| md = cache_file.match(/^cookbooks\/([^\/]+)\/([^\/]+)\/(.*)/) next unless md + ( cookbook_name, segment, file ) = md[1..3] if have_cookbook?(cookbook_name) manifest_segment = cookbook_segment(cookbook_name, segment) @@ -297,6 +298,7 @@ class Chef def cached_copy_up_to_date?(local_path, expected_checksum) return true if Chef::Config[:skip_cookbook_sync] + if cache.key?(local_path) current_checksum = CookbookVersion.checksum_cookbook_file(cache.load(local_path, false)) expected_checksum == current_checksum diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb index 89061d4f5f..6c1f710f6d 100644 --- a/lib/chef/cookbook/syntax_check.rb +++ b/lib/chef/cookbook/syntax_check.rb @@ -62,6 +62,7 @@ class Chef def ensure_cache_path_created return true if @cache_path_created + FileUtils.mkdir_p(cache_path) @cache_path_created = true end @@ -86,6 +87,7 @@ class Chef unless cookbook_path raise ArgumentError, "Cannot find cookbook #{cookbook_name} unless Chef::Config.cookbook_path is set or an explicit cookbook path is given" end + new(File.join(cookbook_path, cookbook_name.to_s)) end @@ -157,6 +159,7 @@ class Chef def validate_ruby_files untested_ruby_files.each do |ruby_file| return false unless validate_ruby_file(ruby_file) + validated(ruby_file) end end @@ -164,6 +167,7 @@ class Chef def validate_templates untested_template_files.each do |template| return false unless validate_template(template) + validated(template) end end |