A script to test uploading of cookbooks to Hosted Chef
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
#!/usr/bin/env ruby | |
NoteOnUsage = <<USAGE | |
This script allows you to upload multiple cookbooks automatically. | |
Use -d to download the cookbooks | |
Use -p to purge cookbooks | |
Using either option will require some user input | |
In the cookbooks string array, replace the list with the cookbooks | |
you want to use | |
This assumes you have a working knife setup with a valid config | |
and valid hosted account | |
USAGE | |
purge = false | |
download = false | |
ARGV.each do |arg| | |
if arg == "-p" | |
purge = true | |
end | |
if arg == "-d" | |
download = true | |
end | |
end | |
cookbooks = %w{apache2 build-essential ucspi-tcp daemontools unicorn bluepill djbdns} | |
if purge | |
cookbooks.each do |cookbook| | |
system("knife cookbook delete -p -a #{cookbook}") | |
end | |
end | |
if download | |
cookbooks.each do |cookbook| | |
system("knife cookbook site download #{cookbook}") | |
system("knife cookbook site install #{cookbook}") | |
end | |
end | |
cookbooks.each do |cookbook| | |
system("knife cookbook upload #{cookbook} -VV") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment