Created
February 16, 2011 17:08
-
-
Save jbz/829733 to your computer and use it in GitHub Desktop.
knife.rb that switches Opscode orgs/validators based on git branch
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
# This knife.rb orig. provided by jtimberman@opscode.com - but any mistakes are mine! | |
current_dir = File.dirname(__FILE__) | |
platform = "https://api.opscode.com/organizations" | |
require 'grit' | |
branch = Grit::Repo.new("#{current_dir}/..").head.name | |
case branch | |
when "dev" | |
orgname = "ourfirm-dev" | |
url = "#{platform}/#{orgname}" | |
when "test" | |
orgname = "ourfirm-test" | |
url = "#{platform}/#{orgname}" | |
when "production" | |
orgname = "ourfirm-production" | |
url = "#{platform}/#{orgname}" | |
end | |
validation_key "#{current_dir}/#{orgname}-validator.pem" | |
chef_server_url url | |
log_level :info | |
log_location STDOUT | |
node_name "<<username>>" | |
client_key "#{current_dir}/<<username>>.pem" | |
validation_client_name "#{orgname}-validator" | |
cache_type 'BasicFile' | |
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" ) | |
cookbook_path ["#{current_dir}/../cookbooks"] | |
cookbook_copyright "Our Company, Inc." | |
cookbook_license "apachev2" | |
cookbook_email "cookbooks@ourfirm.com" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment