summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/cookbook_version.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 27dc8ef9e5..cbae3a552d 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -169,14 +169,7 @@ class Chef
next unless @manifest.has_key?(segment)
filenames = @manifest[segment].map{|manifest_record| manifest_record['name']}
- if segment == :recipes
- self.recipe_filenames = filenames
- elsif segment == :attributes
- self.attribute_filenames = filenames
- else
- segment_filenames(segment).clear
- filenames.each { |filename| segment_filenames(segment) << filename }
- end
+ replace_segment_filenames(segment, filenames)
end
end
@@ -272,6 +265,17 @@ class Chef
end
end
+ def replace_segment_filenames(segment, filenames)
+ case segment.to_sym
+ when :recipes
+ self.recipe_filenames = filenames
+ when :attributes
+ self.attribute_filenames = filenames
+ else
+ segment_filenames(segment).replace(filenames)
+ end
+ end
+
# Query whether a template file +template_filename+ is available. File
# specificity for the given +node+ is obeyed in the lookup.
def has_template_for_node?(node, template_filename)