RightScale depends on a cookbook's metadata to locate all of its contents so that the its resources can be used in the RightScale management system. Although, RightScale uses the metadata.json file to show a cookbook's contents in the RightScale dashboard, it's automatically generated for you (unless a metadata.json file is present) from the metadata.rb file, which is the more user-friendly metadata file. As a cookbook developer, you are only required to manually edit the metadata.rb file. You're responsible for properly updating and maintaining a cookbook's metadata.rb file to ensure that its related recipes and inputs can be used in the RightScale platform as expected. See Chef Metadata.
Below is a screenshot of a properly formatted metadata.rb file.
For a detailed description of each field, see http://wiki.opscode.com/display/chef/Metadata#
Basic information about the cookbook is defined in the header section of the metadata.rb file.
If a recipe in the cookbook depends on parameters that are set by the 'default.rb' recipe of a different cookbook, you need to declare them with a 'depends' statement in the cookbook's metadata. Only cookbooks (not recipes) are allowed to have dependencies. The 'depends' parameter is used for setting a cookbook dependency.
If a particular version of the cookbook is not specified, any version of an attached cookbook (to the ServerTemplate) will satisfy the cookbook dependency (as shown below).
For example, if cookbook A's metadata has a dependency on cookbook B, as long as (any version of) cookbook B is attached to the ServerTemplate, the cookbook dependency will be satisfied.
If possible, it's recommended that you specify which version(s) of a cookbook satisfy a cookbook dependency (as shown below).
depends "cookbook_name", "~> 13.5.0"
For example, if cookbook A's metadata has a dependency on cookbook B, where you must use a version greater than 1.0 (> 1.0), the cookbook dependency will only be satisfied if a version of cookbook B that's version 1.1.0 or greater is attached to the ServerTemplate.
Note: You can only attach a single version of a cookbook to a ServerTemplate. (i.e. You cannot attach v1.0 and v1.1, or v1.0 from repository A and v1.0 from repository B).
See About Versions for more information about valid options and proper syntax for specifying a cookbook's version requirements.
Each recipe must be clearly defined in its cookbook's metadata, otherwise you will not be able add the recipe to a ServerTemplate. Notice how you can use the plus character (+) to split up a long string to make it easier to read. If the recipe contains any inputs, make sure that the recipe is included in the recipes list. See the Declare Inputs section for details.
recipe "app_django::run_custom_django_commands", "Runs specific user defined commands. Commands will be executed" + "in the app directory."
attribute "app/backend_ip_type", :display_name => "Application IP Type Given to Load Balancer", :description => "Specify the IP type where the application server is listening." + "You must specify whether it's a public or private IP." + " Example: private", :required => "recommended", :type => "string", :choice => ["public", "private"], :default => "private", :category => "ACME APP", :recipes => [ "app::install_server", "app::uninstall_server" ]
After the 2013-10-01 Dashboard release, you are no longer required to manually generate the metadata.json file for each cookbook because RightScale will automatically generate the .json file (from the metadata.rb file) each time a cookbook is fetched or refetched. See Chef Metadata for more technical details.
Note: There is a size limit of 64KB on the metadata file that can be generated in cookbooks.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.