lib/contexto/ssh.rb in contexto-0.1.1 vs lib/contexto/ssh.rb in contexto-0.2.0
- old
+ new
@@ -9,14 +9,20 @@
@container = container
@bastion_host = 'bastion.empatico.xyz'
@bastion_user = ''
@user_name = 'ec2-user'
@options = {}
- connect
end
- def connect
- 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 c'\""
- puts cmd
+ def console
+ exec "#{cmd} c'\""
+ end
+
+ def rake(rake_cmd)
+ exec "#{cmd} #{rake_cmd}'\""
+ 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 "
end
end
end