Commit 24e2451c authored by Benjamin Blanc's avatar Benjamin Blanc

testnode: SlapOSMasterCommunicator: repeat curl one more time if it fails

parent d50f286f
...@@ -76,6 +76,18 @@ class SlapOSMasterCommunicator(object): ...@@ -76,6 +76,18 @@ class SlapOSMasterCommunicator(object):
response = self.connection.getresponse() response = self.connection.getresponse()
except: except:
raise ValueError("Impossible to use connection") raise ValueError("Impossible to use connection")
try:
return json.loads(response.read())
except:
# Repet action after 2 secs
time.sleep(2)
try:
# Try to update and use the connection
self.connection = self._getConnection(self.certificate_path, self.key_path, self.url)
self.connection.request(method='GET', url=api_path, headers={'Accept': link['type']}, body="")
response = self.connection.getresponse()
except:
raise ValueError("Impossible to use connection")
return json.loads(response.read()) return json.loads(response.read())
def _update_hosting_subscription_informations(self): def _update_hosting_subscription_informations(self):
......
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