MinimalCookbookVersion is a duck type of CookbookVersion, used internally by Chef Server as an optimization when determining the optimal cookbook set for a chef-client. MinimalCookbookVersion objects contain only enough information to solve the cookbook collection for a given run list. They *do not* contain enough information to generate the response. See also: Chef::CookbookVersionSelector
Loads the full list of cookbooks, using a couchdb view to fetch only the id, name, version, and dependency constraints. This is enough information to solve for the cookbook collection for a given run list. After solving for the cookbook collection, you need to call load_full_versions_of to convert MinimalCookbookVersion objects to their non-minimal counterparts
# File lib/chef/cookbook_version.rb, line 62 def self.load_all(couchdb) # Example: # {"id"=>"1a806f1c-b409-4d8e-abab-fa414ff5b96d", "key"=>"activemq", "value"=>{"version"=>"0.3.3", "deps"=>{"java"=>">= 0.0.0", "runit"=>">= 0.0.0"}}} couchdb ||= Chef::CouchDB.new couchdb.get_view("cookbooks", "all_with_version_and_deps")["rows"].map {|params| self.new(params) } end
Loads the non-minimal CookbookVersion objects corresponding to minimal_cookbook_versions from couchdb using a bulk GET.
# File lib/chef/cookbook_version.rb, line 71 def self.load_full_versions_of(minimal_cookbook_versions, couchdb) database_ids = Array(minimal_cookbook_versions).map {|mcv| mcv.couchdb_id } couchdb ||= Chef::CouchDB.new couchdb.bulk_get(*database_ids) end
# File lib/chef/cookbook_version.rb, line 99 def <=>(o) raise Chef::Exceptions::CookbookVersionNameMismatch if self.name != o.name raise "Unexpected comparison to #{o}" unless o.respond_to?(:legit_version) legit_version <=> o.legit_version end
# File lib/chef/cookbook_version.rb, line 95 def legit_version @legit_version ||= Chef::Version.new(@version) end
Returns the Cookbook::MinimalMetadata object for this cookbook version.
# File lib/chef/cookbook_version.rb, line 91 def metadata @metadata ||= Cookbook::MinimalMetadata.new(@name, DEPENDENCIES => @deps) end
Generated with the Darkfish Rdoc Generator 2.