Commit b824c949 authored by Ivan Tyagov's avatar Ivan Tyagov

Rework loop as in previous implementation end loop condition was

evaluated before timeout and thus causing unexpected AttributeErrors
later.
parent 5a7c6ee0
...@@ -466,12 +466,16 @@ Require valid-user ...@@ -466,12 +466,16 @@ Require valid-user
logger.info("Getting instance information:") logger.info("Getting instance information:")
instance_information_time = time.time() instance_information_time = time.time()
instance_information = self.slapos_communicator.getInstanceUrlDict() instance_information = self.slapos_communicator.getInstanceUrlDict()
while not instance_information['frontend-url-list'] and \ while (time.time() - instance_information_time < MAX_FRONTEND_TIME):
not instance_information['user'] and \ logger.info("getInstanceInformation=%s" %instance_information)
not instance_information['password'] and \ # loop until frontend is instanciated
time.time() - instance_information_time < MAX_FRONTEND_TIME: if instance_information['frontend-url-list'] and \
time.sleep(5*60) instance_information['user'] and \
instance_information['password']:
break
time.sleep(60)
instance_information = self.slapos_communicator.getInstanceUrlDict() instance_information = self.slapos_communicator.getInstanceUrlDict()
logger.info(instance_information) logger.info(instance_information)
if not instance_information['frontend-url-list']: if not instance_information['frontend-url-list']:
raise ValueError("Error getting instance information: frontend url not available") raise ValueError("Error getting instance information: frontend url not available")
......
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