lib/contexto/ssh.rb in contexto-0.2.1 vs lib/contexto/ssh.rb in contexto-0.2.2

- old
+ new

@@ -12,17 +12,25 @@ @user_name = 'ec2-user' @options = {} end def console - exec "#{cmd} c'\"" + exec "#{ssh_cmd} #{cmd} c'\"" end + def ssh + exec "#{ssh_cmd}\"" + end + def rake(rake_cmd) exec "#{cmd} #{rake_cmd}'\"" end + def ssh_cmd + "ssh -t -A #{@bastion_host} \"ssh -t ec2-user@#{@ipaddress} " + end + def cmd - "ssh -t -A #{@bastion_host} \"ssh -t ec2-user@#{@ipaddress} 'docker exec -it \\$(docker ps | grep ecs-#{@cluster}-#{@service}-.*-#{@container} | cut -d\\ -f1) bin/rails " + "'docker exec -it \\$(docker ps | grep ecs-#{@cluster}-#{@service}-.*-#{@container} | cut -d\\ -f1) bin/rails " end end end