request.py: Don't call master if we already know that it will fail

parent 13fce878
...@@ -140,9 +140,12 @@ class Recipe(object): ...@@ -140,9 +140,12 @@ class Recipe(object):
if self.failed is not None: if self.failed is not None:
# Check instance status to know if instance has been deployed # Check instance status to know if instance has been deployed
try: try:
if self.instance.getComputerId() is not None:
status = self.instance.getState() status = self.instance.getState()
else:
status = 'not ready yet'
except (slapmodule.NotFoundError, slapmodule.ServerError): except (slapmodule.NotFoundError, slapmodule.ServerError):
status = 'not ready yet, please try again' status = 'not ready yet'
except AttributeError: except AttributeError:
status = 'unknown' status = 'unknown'
error_message = 'Connection parameter %s not found. '\ error_message = 'Connection parameter %s not found. '\
...@@ -163,7 +166,10 @@ class RequestOptional(Recipe): ...@@ -163,7 +166,10 @@ class RequestOptional(Recipe):
if self.failed is not None: if self.failed is not None:
# Check instance status to know if instance has been deployed # Check instance status to know if instance has been deployed
try: try:
if self.instance.getComputerId() is not None:
status = self.instance.getState() status = self.instance.getState()
else:
status = 'not ready yet'
except (slapmodule.NotFoundError, slapmodule.ServerError): except (slapmodule.NotFoundError, slapmodule.ServerError):
status = 'not ready yet' status = 'not ready yet'
except AttributeError: except AttributeError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment