juju/juju — pull request #1049 by voidspace (2014-11-05 12:08:47+00:00)
Title: Ec2 allocate address

Implement AllocateAddress for ec2 provider. This assigns a private IP address to the network interface for a given ec2 instance id, returning custom errors when the ip address is unavailable or no more ip addresses can be assigned to the network interface. For transient errors due to network flakiness we retry the api calls.

Currently the error conditions can't be directly tested due to lack of support in the goamz test server. The happy path also can't be directly tested as we can't hit the test server (to introspect the network interface) from the black box tests and the new IP address doesn't show up on the instance as reported by Environ.AllInstances(). This maybe due to a bug, or missing feature, in the implementation of the test server assignPrivateIPAddresses. For now the call is mocked. A better approach will be to improve the goamz test server.