[chef] Re: Inconsistent Behavior Between ssh execution and "knife ssh" execution


Chronological Thread 
  • From: Michael Glenney < >
  • To:
  • Subject: [chef] Re: Inconsistent Behavior Between ssh execution and "knife ssh" execution
  • Date: Mon, 23 Jul 2012 15:12:52 -0700

There is definitely a difference between running in a tty as opposed to a ptty (run into this all the time when executing remote commands with ssh) and that's probably what's happening with knife ssh as well.  You can verify by running 'env' from the command line and again when using knife ssh as the same user and compare the output.  You'll probably find the answer to your question there.

MG

On Mon, Jul 23, 2012 at 2:16 PM, Robby Grossman < " target="_blank"> > wrote:
I'm writing a cookbook for a Torquebox-based application server, and seeing some odd behavior when using knife for deploys.

When logging into a box as user "ubuntu" and running "sudo chef-client", everything works fine.

When I do the same via "knife ssh", I get GemNotFound errors when calling rake. This leads me to believe it's an environment/path problem, but I can't figure out what would be different. Does knife alter the environment in which a command is executed?

Here is my knife command: knife ssh "role:rails_app_server" interactive -x ubuntu -a ec2.public_hostname -C 1

And here is the error with debug level output:
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:17 +0000] INFO: execute[jruby -J-Xmx2048m -J-Xms512m -J-Xmn128m -S bundle install --without development test --deployment] ran successfully
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:17 +0000] INFO: deploy[/var/www/shareaholic_on_rails] made pre-migration symlinks
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] INFO: deploy[/var/www/shareaholic_on_rails] set user to torquebox
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] INFO: deploy[/var/www/shareaholic_on_rails] set group to torquebox
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] INFO: deploy[/var/www/shareaholic_on_rails] migrating torquebox with environment RACK_ENV='production' JRUBY_OPTS='--1.9'
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] DEBUG: Executing jruby -S bundle exec rake db:migrate
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: ---- Begin output of jruby -S bundle exec rake db:migrate ----
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: STDOUT: 
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: STDERR: Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources
ec2-23-20-158-139.compute-1.amazonaws.com       materialize at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90
ec2-23-20-158-139.compute-1.amazonaws.com              map! at org/jruby/RubyArray.java:2371
ec2-23-20-158-139.compute-1.amazonaws.com       materialize at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83
ec2-23-20-158-139.compute-1.amazonaws.com             specs at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:127
ec2-23-20-158-139.compute-1.amazonaws.com         specs_for at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:172
ec2-23-20-158-139.compute-1.amazonaws.com   requested_specs at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:161
ec2-23-20-158-139.compute-1.amazonaws.com   requested_specs at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/environment.rb:23
ec2-23-20-158-139.compute-1.amazonaws.com             setup at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:11
ec2-23-20-158-139.compute-1.amazonaws.com             setup at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:107
ec2-23-20-158-139.compute-1.amazonaws.com            (root) at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/setup.rb:17
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: ---- End output of jruby -S bundle exec rake db:migrate ----
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: Ran jruby -S bundle exec rake db:migrate returned 1

Any thoughts would be much appreciated.

--Robby

-- 
Robby Grossman




Archive powered by MHonArc 2.6.16.

§