Skip to content

Instantly share code, notes, and snippets.

@eherot
Created June 6, 2016 20:29
Show Gist options
  • Save eherot/be10d5d236f98e053e6b47c4eb8b5dea to your computer and use it in GitHub Desktop.
Save eherot/be10d5d236f98e053e6b47c4eb8b5dea to your computer and use it in GitHub Desktop.
Check which cookbooks haven't been promoted to prod
require 'chef'
require 'chef/knife'
Chef::Knife.new.configure_chef
rest = Chef::ServerAPI.new Chef::Config[:chef_server_url]
cookbooks = rest.get_rest 'cookbooks'
rest.get_rest('environments/prod')['cookbook_versions'].reject do |cb,v|
Gem::Dependency.new('', v).match?('', cookbooks[cb]['versions'].sort_by{|k|k['version']}.first['version'])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment