lib/capistrano/chef.rb in capistrano-chef-0.0.5 vs lib/capistrano/chef.rb in capistrano-chef-0.0.6
- old
+ new
@@ -6,11 +6,11 @@
module Capistrano::Chef
# Set up chef configuration
def self.configure_chef
knife = Chef::Knife.new
# If you don't do this it gets thrown into debug mode
- knife.config = { :verbosity => 1 }
+ Chef::Config[:verbosity] = 1 # :info
knife.configure_chef
end
# Do a search on the Chef server and return an attary of the requested
# matching attributes
@@ -46,10 +46,15 @@
self.configure_chef
configuration.set :capistrano_chef, self
configuration.load do
def chef_role(name, query = '*:*', options = {})
options = {:attribute => :ipaddress, :limit => 1000}.merge(options)
- role name, *(capistrano_chef.search_chef_nodes(query, options.delete(:attribute), options.delete(:limit)) + [options])
+ # Don't do the lookup if HOSTS is used.
+ # Allows deployment from knifeless machine
+ # to specific hosts (ie. developent, staging)
+ unless ENV['HOSTS']
+ role name, *(capistrano_chef.search_chef_nodes(query, options.delete(:attribute), options.delete(:limit)) + [options])
+ end
end
def set_from_data_bag(data_bag = :apps)
raise ':application must be set' if fetch(:application).nil?
capistrano_chef.get_data_bag_item(application, data_bag).each do |k, v|