summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_manifest.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-02-10 13:01:57 -0800
committerdanielsdeleo <dan@getchef.com>2015-02-11 10:52:50 -0800
commit1a09de46463df00b022700f3b1f872a3203bc9cc (patch)
tree77eb81fbefa9c6050bda20c33821a24f5bba9e71 /lib/chef/cookbook_manifest.rb
parent320a3871d8ac3699e55a063d697537a9538435c6 (diff)
downloadchef-1a09de46463df00b022700f3b1f872a3203bc9cc.tar.gz
Reorganize delegated methods on CookbookVersion, cleanup comments
Diffstat (limited to 'lib/chef/cookbook_manifest.rb')
-rw-r--r--lib/chef/cookbook_manifest.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/chef/cookbook_manifest.rb b/lib/chef/cookbook_manifest.rb
index ef4adfbeb9..30f8596b39 100644
--- a/lib/chef/cookbook_manifest.rb
+++ b/lib/chef/cookbook_manifest.rb
@@ -24,7 +24,9 @@ class Chef
# to a Chef Server.
class CookbookManifest
- # TODO: duplicates the same constant in CookbookVersion
+ # Duplicates the same constant in CookbookVersion. We cannot remove it
+ # there because it is treated by other code as part of CookbookVersion's
+ # public API (also used in some deprecated methods).
COOKBOOK_SEGMENTS = [ :resources, :providers, :recipes, :definitions, :libraries, :attributes, :files, :templates, :root_files ].freeze
extend Forwardable
@@ -144,14 +146,14 @@ class Chef
"#{cookbook_url_path}/#{name}/#{version}?force=true"
end
- # TODO: This is kind of terrible. investigate removing it
+ # Update this CookbookManifest from the contents of another manifest, and
+ # make the corresponding changes to the cookbook_version object. Required
+ # to provide backward compatibility with CookbookVersion#manifest= method.
def update_from(new_manifest)
@manifest = Mash.new new_manifest
@checksums = extract_checksums_from_manifest(@manifest)
@manifest_records_by_path = extract_manifest_records_by_path(@manifest)
- # TODO: this part of this method is "feature envious" it only deals with
- # mutating the CookbookVersion object.
COOKBOOK_SEGMENTS.each do |segment|
next unless @manifest.has_key?(segment)
filenames = @manifest[segment].map{|manifest_record| manifest_record['name']}
@@ -250,9 +252,6 @@ class Chef
checksums
end
- # TODO: delegating to a class method like this is ugly. We should be able
- # to fix this by moving logic into a class in a way that will make it easy
- # to add support for SHA-2
def checksum_cookbook_file(filepath)
CookbookVersion.checksum_cookbook_file(filepath)
end