← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~harlowja/cloud-init/ec2-settings-fix into lp:cloud-init

 

Joshua Harlow has proposed merging lp:~harlowja/cloud-init/ec2-settings-fix into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/ec2-settings-fix/+merge/204385

Fix incorrect return
  
get_url_settings should return a pair of
max wait and timeout and not false, fix this
bug by checking the max_wait <= 0 in the calling
function and returning correctly from there
instead.

-- 
https://code.launchpad.net/~harlowja/cloud-init/ec2-settings-fix/+merge/204385
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/ec2-settings-fix into lp:cloud-init.
=== modified file 'cloudinit/sources/DataSourceEc2.py'
--- cloudinit/sources/DataSourceEc2.py	2013-03-20 12:30:43 +0000
+++ cloudinit/sources/DataSourceEc2.py	2014-02-01 20:05:51 +0000
@@ -92,12 +92,9 @@
         except Exception:
             util.logexc(LOG, "Failed to get max wait. using %s", max_wait)
 
-        if max_wait == 0:
-            return False
-
         timeout = 50
         try:
-            timeout = int(mcfg.get("timeout", timeout))
+            timeout = max(0, int(mcfg.get("timeout", timeout)))
         except Exception:
             util.logexc(LOG, "Failed to get timeout, using %s", timeout)
 
@@ -109,6 +106,8 @@
             mcfg = {}
 
         (max_wait, timeout) = self._get_url_settings()
+        if max_wait <= 0:
+            return False
 
         # Remove addresses from the list that wont resolve.
         mdurls = mcfg.get("metadata_urls", DEF_MD_URLS)


Follow ups