ansible/cloud/amazon
tedder c5fe40661d feature pull request: catch and retry recoverable errors
boto can throw SSLError when timeouts occur (among other SSL errors). Catch these so proper JSON can be returned, and also add the ability to retry the operation.

There's an open issue in boto for this: https://github.com/boto/boto/issues/2409

Here's a sample stacktrace that inspired me to work on this. I'm on 1.7, but there's no meaningful differences in the 1.8 release that would affect this. I've added line breaks to the trace for readability.

    failed to parse: Traceback (most recent call last):
      File "/home/ubuntu/.ansible/tmp/ansible-tmp-1419895753.17-160808281985012/s3", line 2031, in <module> main()
      File "/home/ubuntu/.ansible/tmp/ansible-tmp-1419895753.17-160808281985012/s3", line 353, in main download_s3file(module, s3, bucket, obj, dest)
      File "/home/ubuntu/.ansible/tmp/ansible-tmp-1419895753.17-160808281985012/s3", line 234, in download_s3file key.get_contents_to_filename(dest)
      File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1665, in get_contents_to_filename response_headers=response_headers)
      File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1603, in get_contents_to_file response_headers=response_headers)
      File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1435, in get_file query_args=None)
      File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1488, in _get_file_internal for bytes in self:
      File "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 368, in next data = self.resp.read(self.BufferSize)
      File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 416, in read return httplib.HTTPResponse.read(self, amt)
      File "/usr/lib/python2.7/httplib.py", line 567, in read s = self.fp.read(amt)
      File "/usr/lib/python2.7/socket.py", line 380, in read data = self._sock.recv(left)
      File "/usr/lib/python2.7/ssl.py", line 341, in recv return self.read(buflen)
      File "/usr/lib/python2.7/ssl.py", line 260, in read return self._sslobj.read(len) ssl.SSLError: The read operation timed out
2014-12-29 17:19:12 -08:00
..
__init__.py added __init__.py to new cloud subcategories so builds work again 2014-11-05 11:07:19 -05:00
cloudformation.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2.py Remove incorrect executable permissions. 2014-11-13 18:08:48 -05:00
ec2_ami.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_ami_search.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_asg.py Remove incorrect executable permissions. 2014-11-13 18:08:48 -05:00
ec2_eip.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_elb.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_elb_lb.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_facts.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_group.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_key.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_lc.py Remove incorrect executable permissions. 2014-11-13 18:08:48 -05:00
ec2_metric_alarm.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_scaling_policy.py Remove incorrect executable permissions. 2014-11-13 18:08:48 -05:00
ec2_snapshot.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_tag.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_vol.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
ec2_vpc.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
elasticache.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
rds.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
rds_param_group.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
rds_subnet_group.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
route53.py made subcategories for cloud modules for better organization 2014-11-04 11:18:09 -05:00
s3.py feature pull request: catch and retry recoverable errors 2014-12-29 17:19:12 -08:00