← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~juergh/cloud-init/lp1298921 into lp:cloud-init

 

Juerg Haefliger has proposed merging lp:~juergh/cloud-init/lp1298921 into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1298921 in cloud-init (Ubuntu): "cloud-init should give up on 404 errors"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1298921

For more details, see:
https://code.launchpad.net/~juergh/cloud-init/lp1298921/+merge/213234

See related bug report https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1298921
-- 
https://code.launchpad.net/~juergh/cloud-init/lp1298921/+merge/213234
Your team cloud init development team is requested to review the proposed merge of lp:~juergh/cloud-init/lp1298921 into lp:cloud-init.
=== modified file 'cloudinit/url_helper.py'
--- cloudinit/url_helper.py	2014-02-13 17:13:42 +0000
+++ cloudinit/url_helper.py	2014-03-28 11:15:53 +0000
@@ -301,6 +301,7 @@
         return ((max_wait <= 0 or max_wait is None) or
                 (time.time() - start_time > max_wait))
 
+    abort = False
     loop_n = 0
     while True:
         sleep_time = int(loop_n / 5) + 1
@@ -327,6 +328,11 @@
                     reason = "empty response [%s]" % (response.code)
                     e = UrlError(ValueError(reason),
                                  code=response.code, headers=response.headers)
+                elif response.code == 404:
+                    reason = "not found [404]"
+                    e = UrlError(ValueError(reason),
+                                 code=response.code, headers=response.headers)
+                    abort = True
                 elif not response.ok():
                     reason = "bad status code [%s]" % (response.code)
                     e = UrlError(ValueError(reason),
@@ -350,7 +356,7 @@
                 # does.
                 exception_cb(msg=status_msg, exception=e)
 
-        if timeup(max_wait, start_time):
+        if timeup(max_wait, start_time) or abort:
             break
 
         loop_n = loop_n + 1


Follow ups