sprinkle-tool / sprinkle

Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created
https://github.com/sprinkle-tool/sprinkle
MIT License
1.15k stars 138 forks source link

Sudo not working or missing documentation? #190

Closed Keeo closed 10 years ago

Keeo commented 10 years ago

Using capistrano or ssh to log into server i am not able to force it to use sudo. I guess i am missing some flag but i cant find it anywhere. When i log int through putty it works fine. Thanks for advice.

#deploy.rb
set :use_sudo, true
set :user, 'admin'
role :app, '111.111.111.111', primary:  true

default_run_options[:pty] = true
ssh_options[:auth_methods] = ["publickey"]
ssh_options[:keys] = ["pathto.pem"]
#package
package :test do
  description "sudo test"
  runner "cat /var/lib/dpkg/lock"
end
#packate2 (same problem)
package :mysql do
  description 'Mysql 5.5 server'
  requires :test
  apt "mysql-server-5.5"
    verify { has_apt 'mysql-server-5.5' }
end
------------------------------------------------------
|       Package 'test' returned error code ??.       |
------------------------------------------------------

Command
---------
cat /var/lib/dpkg/lock

Hosts
-------
111.111.111.111

STDOUT
--------
cat: /var/lib/dpkg/lock: Permission denied

Actor error message
---------------------
failed: "sh -c 'cat /var/lib/dpkg/lock'" on 111.111.111.111
Keeo commented 10 years ago

Ok, i have found flag to force sudo for ssh

delivery :ssh do
    user "asdfg"
    password "asdfg"
    role :app, "111.111.111.111"
    use_sudo true
  end

if this is expected behavior please close.

joshgoebel commented 10 years ago

Should be resolved by 32325b868d0c61e8aef4381b194318b36a2de490. Will make a gem release soon.