boto/boto — pull request #1436 by jamesls (2013-04-11 22:01:22+00:00)
Title: Add metadata_service_num_attempts config option

When retrieving credentials from the metadata service,
it is possible to set a config option to specify the number
of seconds before timing out the request, but no option
exists that specifies the number of attempts to make to
the metadata service.

I also made two changes to the metadata retrieval process:

* If we're on the last iteration of our retry loop we
don't sleep. This allows us to maintain our 1 second max delay
by default if no metadata credentials are available.

* Remove urllib2 error catching. This is raised when a timeout
occurs and this is something we definitely want to retry.

Added a unittest for the config option and also verified
on an EC2 instance with an IAM role specified that the failure
conditions are retried appropriately when
metadata_service_num_attempts is set.

cc @garnaat @toastdriven