Class | Chef::CookbookVersion |
In: |
lib/chef/cookbook_version.rb
|
Parent: | Object |
CookbookVersion is a model object encapsulating the data about a Chef cookbook. Chef supports maintaining multiple versions of a cookbook on a single server; each version is represented by a distinct instance of this class.
COOKBOOK_SEGMENTS | = | [ :resources, :providers, :recipes, :definitions, :libraries, :attributes, :files, :templates, :root_files ] |
DESIGN_DOCUMENT | = | { "version" => 8, "language" => "javascript", "views" => { "all" => { "map" => <<-EOJS function(doc) { if (doc.chef_type == "cookbook_version") { emit(doc.name, doc); } } EOJS |
attribute_filenames | -> | attribute_files |
BACKCOMPAT/DEPRECATED - Remove these and fix breakage before release [DAN - 5/20/2010]## | ||
recipe_filenames | -> | recipe_files |
BACKCOMPAT/DEPRECATED - Remove these and fix breakage before release [DAN - 5/20/2010]## |
attribute_filenames | [R] | attribute_filenames also has a setter that has non-default functionality. |
attribute_filenames_by_short_filename | [R] | |
couchdb | [RW] | |
couchdb_id | [R] | |
couchdb_rev | [RW] | |
definition_filenames | [RW] | |
file_filenames | [RW] | |
library_filenames | [RW] | |
metadata | [RW] | |
metadata_filenames | [RW] | |
name | [RW] | |
provider_filenames | [RW] | |
recipe_filenames | [R] | recipe_filenames also has a setter that has non-default functionality. |
recipe_filenames_by_name | [R] | |
resource_filenames | [RW] | |
root_dir | [RW] | |
root_filenames | [RW] | |
status | [RW] | |
template_filenames | [RW] |
This is the one and only method that knows how cookbook files’ checksums are generated.
Iterates over cached cookbooks’ files, removing files belonging to cookbooks that don‘t appear in cookbook_hash
Update the file caches for a given cache segment. Takes a segment name and a hash that matches one of the cookbooks/_attribute_files style remote file listings.
cookbook<Chef::Cookbook>: | The cookbook to update |
valid_cache_entries<Hash>: | Out-param; Added to this hash are the files that |
were referred to by this cookbook
Keep track of the filenames that we use in both eager cookbook downloading (during sync_cookbooks) and lazy (during the run itself, through FileVendor). After the run is over, clean up the cache.
Returns a hash of checksums to either nil or the on disk path (which is done by generate_manifest).
Adds the `force=true` parameter to the upload URL. This allows the user to overwrite a frozen cookbook (a PUT against the normal save_url raises a 409 Conflict in this case).
A manifest is a Mash that maps segment names to arrays of manifest records (see preferred_manifest_record for format of manifest records), as well as describing cookbook metadata. The manifest follows a form like the following:
{ :cookbook_name = "apache2", :version = "1.0", :name = "Apache 2" :metadata = ???TODO: timh/cw: 5-24-2010: describe this format, :files => [ { :name => "afile.rb", :path => "files/ubuntu-9.10/afile.rb", :checksum => "2222", :specificity => "ubuntu-9.10" }, ], :templates => [ manifest_record1, ... ], ... }
Determine the most specific manifest record for the given segment/filename, given information in the node. Throws FileNotFound if there is no such segment and filename in the manifest.
A manifest record is a Mash that follows the following form: {
:name => "example.rb", :path => "files/default/example.rb", :specificity => "default", :checksum => "1234"
}
Determine the manifest records from the most specific directory for the given node. See preferred_manifest_record for a description of entries of the returned Array.
Runs on Chef Server (API); deletes the cookbook from couchdb and also destroys associated checksum documents
Return the URL to save (PUT) this object to the server via the REST api. If there is an existing document on the server and it is marked frozen, a PUT will result in a 409 Conflict.