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.
MGOn 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 1And 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 successfullyec2-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 symlinksec2-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 torqueboxec2-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 torqueboxec2-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:migrateec2-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 sourcesec2-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:90ec2-23-20-158-139.compute-1.amazonaws.com map! at org/jruby/RubyArray.java:2371ec2-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:83ec2-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:127ec2-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:172ec2-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:161ec2-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:23ec2-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:11ec2-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:107ec2-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:17ec2-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 1Any thoughts would be much appreciated.--Robby
Archive powered by MHonArc 2.6.16.