Created
February 7, 2013 16:37
-
-
Save sean-horn/4732213 to your computer and use it in GitHub Desktop.
Example cookbook Ruby code to show all versions of all cookbooks for the _default env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log "---writing all ckbks and version---" | |
require 'rest_client' | |
env = "_default" | |
num_versions = "num_versions=all" | |
api_endpoint = env ? "/environments/#{env}/cookbooks?#{num_versions}" : "/cookbooks?#{num_versions}" | |
r = Chef::REST.new(Chef::Config[:chef_server_url]) | |
cookbook_versions = r.get_rest(api_endpoint) | |
log "#{cookbook_versions}" | |
log "---End writing all ckbks and version---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment