← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~remy-leone/cloud-init:simplify_comparisons into cloud-init:master

 

Sieben has proposed merging ~remy-leone/cloud-init:simplify_comparisons into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~remy-leone/cloud-init/+git/cloud-init/+merge/340237
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~remy-leone/cloud-init:simplify_comparisons into cloud-init:master.
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
index 0a5be0b..4e814a5 100644
--- a/cloudinit/url_helper.py
+++ b/cloudinit/url_helper.py
@@ -47,7 +47,7 @@ try:
     _REQ_VER = LooseVersion(_REQ.version)  # pylint: disable=no-member
     if _REQ_VER >= LooseVersion('0.8.8'):
         SSL_ENABLED = True
-    if _REQ_VER >= LooseVersion('0.7.0') and _REQ_VER < LooseVersion('1.0.0'):
+    if LooseVersion('0.7.0') <= _REQ_VER < LooseVersion('1.0.0'):
         CONFIG_ENABLED = True
 except ImportError:
     pass
@@ -121,7 +121,7 @@ class UrlResponse(object):
         upper = 300
         if redirects_ok:
             upper = 400
-        if self.code >= 200 and self.code < upper:
+        if 200 <= self.code < upper:
             return True
         else:
             return False
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 02dc2ce..d205946 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -546,7 +546,7 @@ def is_ipv4(instr):
         return False
 
     try:
-        toks = [x for x in toks if int(x) < 256 and int(x) >= 0]
+        toks = [x for x in toks if 0 <= int(x) < 256]
     except Exception:
         return False
 

Follow ups