lib/contexto/ssh.rb in contexto-0.2.3 vs lib/contexto/ssh.rb in contexto-0.2.4

- old
+ new

@@ -1,11 +1,11 @@ # Context module Contexto # SSH class class SSH attr_reader :ipaddress, :cluster, :service, :container - + def initialize(ipaddress, cluster, service, container) @ipaddress = ipaddress @cluster = cluster @service = service @container = container @@ -14,25 +14,29 @@ @user_name = 'ec2-user' @options = {} end def console - exec "#{ssh_cmd} #{cmd} c'\"" + exec "#{ssh_cmd} #{cmd} bin/rails c'\"" end def ssh exec "#{ssh_cmd}\"" end def rake(rake_cmd) - exec "#{cmd} #{rake_cmd}'\"" + exec "#{ssh_cmd} #{cmd} #{rake_cmd}'\"" end + def bash + exec "#{ssh_cmd} #{cmd} /bin/bash'\"" + end + def ssh_cmd "ssh -t -A #{@bastion_host} \"ssh -t ec2-user@#{ipaddress} " end def cmd - "'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) " end end end