crafterm/sprinkle — Issue #60: source installer always uses sudo -p
Author: bcasci
Created: 2012-02-28 09:00:43+00:00
State: open

I honestly don't know if this is a configuration issue or a a bug. I'm using the latest gem (0.4.2). The sprinkle recipe always stops at this package. It successfully installs apt packages and creates users among other things, but I can't get it to successfully install from source. I've tried as root, as a user with sudo privs, and as both types of users with and without ssh keys, and with and without capistrano's set use_sudo.

Do you have any advice?

```bash
--> Installing ruby for roles: app
/home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/command.rb:176:in `process!': failed: "sh -c 'sudo -p '\\''sudo password: '\\'' wget -cq -O '\\''/usr/local/sources/ruby-1.9.3-p195.tar.gz'\\'' ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p195.tar.gz'" on 96.126.104.148 (Capistrano::CommandError)
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/command.rb:134:in `process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/actions/invocation.rb:178:in `block in run_tree'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/connections.rb:198:in `block in execute_on_servers'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/connections.rb:186:in `each'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/connections.rb:186:in `each_slice'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/connections.rb:186:in `execute_on_servers'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/actions/invocation.rb:176:in `run_tree'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/actions/invocation.rb:148:in `run'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/actions/invocation.rb:214:in `sudo'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/actions/invocation.rb:89:in `invoke_command'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:64:in `block (2 levels) in process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:63:in `each'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:63:in `block in process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:103:in `run'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/actors/capistrano.rb:69:in `process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/installers/installer.rb:75:in `process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/package.rb:248:in `block in process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/package.rb:246:in `each'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/package.rb:246:in `process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:92:in `block in process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:121:in `each'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:121:in `normalize'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/policy.rb:91:in `process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/deployment.rb:68:in `block in process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/deployment.rb:67:in `each'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/deployment.rb:67:in `process'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/script.rb:20:in `sprinkle'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/lib/sprinkle/script.rb:16:in `sprinkle'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/gems/sprinkle-0.4.2/bin/sprinkle:95:in `'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/bin/sprinkle:19:in `load'
from /home/brandon/.rvm/gems/ruby-1.9.3-p125@loudcity_stats/bin/sprinkle:19:in `

'

```ruby
package :ruby do
requires :ruby_dependencies
description 'Ruby Virtual Machine'
version '1.9.3'
patchlevel '195'

source "ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}-p#{patchlevel}.tar.gz",:sudo => false do
pre :install, 'apt-get purge ruby ruby1.9 ruby1.9.1 rubygems1.8 rubygems1.9 rubygems1.9.1'
end

verify { has_executable_with_version "/usr/local/bin/ruby", version }
end

package :ruby_dependencies do
description 'Ruby Virtual Machine Build Dependencies'
apt %w( bison zlib1g-dev libssl-dev libreadline-gplv2-dev libncurses5-dev libyaml-0-2 file )
end

```ruby
# Example configuration file for Capistrano Sprinkle deploy strategy
#
#
# -- Application configuration
#
# Note: The default Vagrant box IP is "33.33.33.10"
#
role :app, '192.168.1.100', :primary => true

# --- SSH connection configuration
#
# Note: The default Vagrant user is "vagrant"
#
set :user, 'deploy'
#
# -- SSH options
#
# - Port
# ssh_options[:port] = 22
#
# - Authenticate with key pair, not password
# ssh_options[:keys] = ['/path/to/your/private/key']
#
# Configuration for the Vagrant box:
#
#ssh_options[:keys] = File.join(File.dirname(`gem which vagrant`.strip), '../keys/vagrant')
#
# - Use sudo
set :use_sudo, false
#
# - Declare intareactive terminal
default_run_options[:pty] = true
#
ssh_options[:forward_agent] = true
ssh_options[:keys] = %w(/home/#{ENV['USER']}/.ssh/id_dsa)