Skip to content

Instantly share code, notes, and snippets.

@mpasternacki
Created February 3, 2011 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpasternacki/809433 to your computer and use it in GitHub Desktop.
Save mpasternacki/809433 to your computer and use it in GitHub Desktop.
Make shef try to load current knife config by default
# ~/.chef/shef.rb
begin
# Load configuration from knife.rb
require 'chef/knife'
Chef::Knife.new.configure_chef
rescue
puts <<-EOF
Can't load knife config: #{$!}
This is probably nothing serious.
EOF
else
# monkey-patch Shef to prevent it from setting Chef::Config[:solo] to true
class Shef::StandAloneSession
alias_method :rebuild_node_orig, :rebuild_node
def rebuild_node
rebuild_node_orig
Chef::Config[:solo] = false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment