diff options
author | Daniel Watkins <daniel.watkins@canonical.com> | 2015-05-08 16:52:49 +0100 |
---|---|---|
committer | Daniel Watkins <daniel.watkins@canonical.com> | 2015-05-08 16:52:49 +0100 |
commit | 512eb552e0ca740e1d285dc1b66a56579bcf68ec (patch) | |
tree | b47f5203d9cf60f2d6e5737303e8feb6fed2ad73 /cloudinit/sources | |
parent | d8a1910ae79478b8976c4950219d37e15640e7e7 (diff) | |
download | vyos-cloud-init-512eb552e0ca740e1d285dc1b66a56579bcf68ec.tar.gz vyos-cloud-init-512eb552e0ca740e1d285dc1b66a56579bcf68ec.zip |
Fix retrying.
Diffstat (limited to 'cloudinit/sources')
-rw-r--r-- | cloudinit/sources/helpers/azure.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py index dfdfa7c2..2ce728f5 100644 --- a/cloudinit/sources/helpers/azure.py +++ b/cloudinit/sources/helpers/azure.py @@ -242,14 +242,19 @@ class WALinuxAgentShim(object): self.openssl_manager = OpenSSLManager() http_client = AzureEndpointHttpClient(self.openssl_manager.certificate) LOG.info('Registering with Azure...') - for i in range(10): + attempts = 0 + while True: try: response = http_client.get( 'http://{}/machine/?comp=goalstate'.format(self.endpoint)) except Exception: - time.sleep(i + 1) + if attempts < 10: + time.sleep(attempts + 1) + else: + raise else: break + attempts += 1 LOG.debug('Successfully fetched GoalState XML.') goal_state = GoalState(response.contents, http_client) public_keys = [] |