mitchellh / vagrant-aws

Use Vagrant to manage your EC2 and VPC instances.
MIT License
2.61k stars 574 forks source link

Vagrant should catch the ECONNREFUSED error and re-try #478

Closed kenorb closed 7 years ago

kenorb commented 8 years ago

Currently Vagrant stops on the first connection error without trying to re-connect. This cause disconnection from the ec2 instance leaving it running without ability to clean up. My internet connection is fine.

Error:

Host path: ~/_VM/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o ControlMaster=auto -o ControlPath=/var/folders/vp/tlt7xf791gl1_v56m0xdmrph0000gn/T/ssh.850 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i '~/test.pem' --exclude .vagrant/ ~/_VM/ ubuntu@52.23.173.123:/vagrant
Error: ssh: connect to host 52.23.173.123 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/socket.rb:132:in `connect_nonblock': Connection refused - connect(2) for 54.239.28.176:443 (Errno::ECONNREFUSED) (Excon::Errors::SocketError)
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/socket.rb:132:in `rescue in block in connect'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/socket.rb:111:in `block in connect'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/socket.rb:102:in `each'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/socket.rb:102:in `connect'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/ssl_socket.rb:146:in `connect'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/socket.rb:28:in `initialize'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/ssl_socket.rb:8:in `initialize'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:404:in `new'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:404:in `socket'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:106:in `request_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/mock.rb:47:in `request_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/instrumentor.rb:25:in `request_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:15:in `request_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:250:in `request'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/idempotent.rb:26:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:10:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:10:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:273:in `rescue in request'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:221:in `request'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/idempotent.rb:26:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:10:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:10:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:273:in `rescue in request'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:221:in `request'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/idempotent.rb:26:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:10:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/middlewares/base.rb:10:in `error_call'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:273:in `rescue in request'
    from ~/.vagrant.d/gems/gems/excon-0.49.0/lib/excon/connection.rb:221:in `request'
    from ~/.vagrant.d/gems/gems/fog-xml-0.1.2/lib/fog/xml/sax_parser_connection.rb:35:in `request'
    from ~/.vagrant.d/gems/gems/fog-xml-0.1.2/lib/fog/xml/connection.rb:7:in `request'
    from ~/.vagrant.d/gems/gems/fog-aws-0.9.2/lib/fog/aws/compute.rb:525:in `_request'
    from ~/.vagrant.d/gems/gems/fog-aws-0.9.2/lib/fog/aws/compute.rb:520:in `request'
    from ~/.vagrant.d/gems/gems/fog-aws-0.9.2/lib/fog/aws/requests/compute/describe_instances.rb:81:in `describe_instances'
    from ~/.vagrant.d/gems/gems/fog-aws-0.9.2/lib/fog/aws/models/compute/servers.rb:62:in `all'
    from ~/.vagrant.d/gems/gems/fog-aws-0.9.2/lib/fog/aws/models/compute/servers.rb:149:in `get'
    from ~/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/read_ssh_info.rb:24:in `read_ssh_info'
    from ~/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/read_ssh_info.rb:15:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/warden.rb:34:in `call'
    from ~/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/connect_aws.rb:43:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/warden.rb:34:in `call'
    from ~/.vagrant.d/gems/gems/vagrant-auto_network-1.0.2/lib/auto_network/action/request.rb:24:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/warden.rb:34:in `call'
    from ~/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/warden.rb:34:in `call'
    from ~/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/warden.rb:34:in `call'
    from ~/.vagrant.d/gems/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:17:in `call'