summaryrefslogtreecommitdiff
path: root/cloudinit/sources/helpers/azure.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/sources/helpers/azure.py')
-rw-r--r--cloudinit/sources/helpers/azure.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py
index 19584a61..56f44339 100644
--- a/cloudinit/sources/helpers/azure.py
+++ b/cloudinit/sources/helpers/azure.py
@@ -363,8 +363,16 @@ def http_with_retries(
% (url, attempt, e, e.code, e.headers),
logger_func=LOG.debug,
)
- # Raise exception if we're out of time.
- if time() + retry_sleep >= timeout:
+ # Raise exception if we're out of time or network is unreachable.
+ # If network is unreachable:
+ # - retries will not resolve the situation
+ # - for reporting ready for PPS, this generally means VM was put
+ # to sleep or network interface was unplugged before we see
+ # the call complete successfully.
+ if (
+ time() + retry_sleep >= timeout
+ or "Network is unreachable" in str(e)
+ ):
raise
sleep(retry_sleep)