0

rbenv and Ruby are setup for the logged in sshkit user, but the path seems broken.

`rescue in block (2 levels) in execute': Exception while executing as user@server.com : bundle install exit status: 127 (SSHKit::Runner::ExecuteError)
bundle install stdout: Nothing written
bundle install stderr: bash: bundle: command not found

How do I use Ruby and gems with sshkit?

on hosts, in: :parallel do |host|
  with http_proxy: 'myproxy',
       https_proxy: 'myproxy' do
      within "/home/user/stufftorun" do
        execute :git, "fetch"
        execute :git, "pull", "origin", "master"
        execute "rbenv exec bundle install" # this fails
        execute "threads=4 report=./reports/test.out bundle exec cucumber -q"
      end
  end
end
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
  • Can you prefix your commands with `rbenv exec` and see if you get the same error. – lorefnon Dec 01 '15 at 16:15
  • rbenv - command not found. – Stefan Kendall Dec 01 '15 at 16:16
  • Can you provide the code that you are executing. – lorefnon Dec 01 '15 at 16:21
  • Is rbenv installed in the remote machine already ? if yes, can you add `execute :echo, "$PATH"` to print if rbenv is in path. Given sshkit establishes a non-interactive session the path can be different to what you might have when you ssh manually. – lorefnon Dec 01 '15 at 17:16
  • @lorefnon the path is wrong, but I can't source ~/.bashrc and have that work, and with path: "blah:$PATH" seems to be completely ignored. – Stefan Kendall Dec 01 '15 at 17:33
  • source will not work if you have it in a separate statement, because if you see the [source](https://github.com/capistrano/sshkit/blob/da27581a3001ce5a29ab2840933a00d57dcd6ea8/lib/sshkit/backends/netssh.rb#L88) , each `execute` ends up calling a new `open_channel` , you can use the before option introduced [here](https://github.com/capistrano/sshkit/pull/281/files) or more simpler option is to provide the full path of rbenv in `rbenv exec`. – lorefnon Dec 01 '15 at 17:46
  • run `gem env` and copy/paste the output into your question, formatting it for readability. – the Tin Man Jan 27 '16 at 21:48

0 Answers0