Branch: refs/heads/master
Home: https://github.com/NixOS/charon
Commit: e3597bcebf23826eaa3508c307291939d0692334
https://github.com/NixOS/charon/commit/e3597bcebf23826eaa3508c307291939d0692334
Author: Eelco Dolstra <[email protected]>
Date: 2012-05-01 (Tue, 01 May 2012)
Changed paths:
M charon/backends/ec2.py
Log Message:
-----------
Handle bogus EC2 "does not exist" errors on instance creation
Fixes #17.
diff --git a/charon/backends/ec2.py b/charon/backends/ec2.py
index b4c1e73..4072334 100644
--- a/charon/backends/ec2.py
+++ b/charon/backends/ec2.py
@@ -357,6 +357,17 @@ def create(self, defn, check):
self.write()
+ # There is a short time window during which EC2 doesn't
+ # know the instance ID yet. So wait until it does.
+ while True:
+ try:
+ instance = self._get_instance_by_id(self._instance_id)
+ break
+ except boto.exception.EC2ResponseError as e:
+ if e.error_code != "InvalidInstanceID.NotFound": raise
+ self.log("EC2 instance ‘{0}’ not known yet,
waiting...".format(self._instance_id))
+ time.sleep(3)
+
# Reapply tags if they have changed.
common_tags = {'CharonNetworkUUID': str(self.depl.uuid),
'CharonMachineName': self.name}
tags = {'Name': "{0} [{1}]".format(self.depl.description, self.name)}
================================================================
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits