summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2017-04-11 11:39:13 +0100
committerThom May <thom@chef.io>2017-04-11 11:39:13 +0100
commit896c94c70023406e88eb3efaa3c680ab4cc17646 (patch)
treec78dbc50101e91752e8e407cab1270464d3a154e
parentccfed2a1edfc53faa16319b11359d7ece47cb556 (diff)
downloadchef-896c94c70023406e88eb3efaa3c680ab4cc17646.tar.gz
ensure all required fields are preserved in ManifestV0
Signed-off-by: Thom May <thom@chef.io>
-rw-r--r--lib/chef/cookbook/manifest_v0.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/cookbook/manifest_v0.rb b/lib/chef/cookbook/manifest_v0.rb
index 400b960dfc..fd2d62a6d4 100644
--- a/lib/chef/cookbook/manifest_v0.rb
+++ b/lib/chef/cookbook/manifest_v0.rb
@@ -27,13 +27,14 @@ class Chef
COOKBOOK_SEGMENTS = %w{ resources providers recipes definitions libraries attributes files templates root_files }
def self.from_hash(hash)
- response = Mash.new
+ 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"]}" unless segment == "root_files"
memo << file
end
+ response.delete(segment)
memo
end
response