Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7862105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:59:57+00:00 2026-06-02T22:59:57+00:00

I have a rails web application that allows users to run automated tasks with

  • 0

I have a rails web application that allows users to run automated tasks with multiple servers. I wired up a rake task to run every 5 minutes (whenever gem) and check for jobs that need to be executed and spin up the servers with the appropriate options.

My trouble is in actually running chef’s knife command. I currently do:

sh %{bash -c -l 'cd ~/opscode/FTW && source ~/.rvm/scripts/rvm && rvm use system && knife rackspace server list'} do |ok, res|
  if ! ok
    puts "meh? (status = #{res.exitstatus})"
    puts res 
  end 
end

this gets me halfway there. It switches to the appropriate gemset (system’s) without any trouble but on execution of knife i get the following:

Could not find multi_json-1.1.0 in any of the sources
Run `bundle install` to install missing gems.

I don’t have bundler installed in the system gems… so I’m pretty confused. multi-json-1.1.0 is required by my web application. My installation of chef seems to require multi_json 1.0.3 so there seems to be a mixup in the gem requirements.

the command runs from bash no problem… it only fails in rake at the knife part

any thoughts?


EDIT:
using mpapis suggestion i used the RVM gem and everything works great in IRB. I do the following

RVM.use! 'system'
env = RVM.current
env.shell_wrapper.run_command("cd /my/path/to/opscode/FTW && knife rackspace server list")

however when running the same code in rails console or from rake i have issues. Rails console essentially ignores my RVM.use! and rake blows up… does it have something to do with bundler interfering?

SOLUTION:
mpapis built a phenomenal gem https://github.com/mpapis/rvm-with that allows you to execute code within a particular ruby version.

RVM.with '1.8.7' do |r| 
  puts r.execute "unset RUBYOPT"
  puts r.execute "cd /home/hunter/opscode/FTW && knife rackspace server list"
  #puts r.execute "ruby --version"
end    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:59:58+00:00Added an answer on June 2, 2026 at 10:59 pm

    SOLUTION: mpapis built a phenomenal gem https://github.com/mpapis/rvm-with that allows you to execute code within a particular ruby version.

    RVM.with '1.8.7' do |r| 
      puts r.execute "unset RUBYOPT"
      puts r.execute "cd /home/hunter/opscode/FTW && knife rackspace server list"
      #puts r.execute "ruby --version"
    end    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a twitter like web application written in Ruby on Rails that allows
I have a Rails 2.3 web application that uses the collection_select helper with :multiple
I have a web application that uses Facebook Connect (built in Ruby on Rails
I have a Rails application that queries a 3rd party web service. I am
Do the major web application frameworks (Rails, Django, etc) have libraries that provide functionality
I have a Rails RESTful web service application that accepts a value from a
I have a RESTful web application that supports multiple sort fields on a collection
Imagine a web application that allows a logged in user to run a shell
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I have a rails application that about 3 years old, and I'm having a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.