We're using Amazon's SNS to notify our application of changes to our autoscaling groups. In the event a server's terminated, we want to delete the node.

The notifications are working fine, as are the auto scaling groups. The only problem I have is that I cannot run the knife command from within my Rails App, I guess because it's calling the wrong Ruby version and trying to use the Application's gems. We're using RVM installed ruby-2.0.0-p195 and I don't want to bundle Chef.

The error therefore when I try and execute knife is:

system "cd /chefroot/ && /usr/bin/knife"
/Users/SM/.rvm/gems/ruby-2.0.0-p195@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:214:in `block in replace_gem': chef is not part of the bundle. Add it to Gemfile. (Gem::LoadError)

I can see knife's calling chef, but needs to do so as a system gem. In knife.rb: