← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~vlastimil-holer/cloud-init/is_ipv4-fix into lp:cloud-init

 

Vlastimil Holer has proposed merging lp:~vlastimil-holer/cloud-init/is_ipv4-fix into lp:cloud-init.

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

For more details, see:
https://code.launchpad.net/~vlastimil-holer/cloud-init/is_ipv4-fix/+merge/203615

Due to bug in function "cloudinit.util.is_ipv4" an IPv4 address with zero (0) at any component wasn't evaluated as IPv4 address.

E.g.: having local datasource with 192.168.0.1 in meta-data/local-hostname. The correct behaviour would be to generate ip-192-168-0-1 hostname. With this bug, the hostname (with IPv4) was considered as FQDN (no IPv4 inside) and just first component (supposed to be hostname there) was taken. It generated hostname "192".
-- 
https://code.launchpad.net/~vlastimil-holer/cloud-init/is_ipv4-fix/+merge/203615
Your team cloud init development team is requested to review the proposed merge of lp:~vlastimil-holer/cloud-init/is_ipv4-fix into lp:cloud-init.
=== modified file 'cloudinit/util.py'
--- cloudinit/util.py	2014-01-25 03:31:28 +0000
+++ cloudinit/util.py	2014-01-28 18:23:59 +0000
@@ -369,7 +369,7 @@
         return False
 
     try:
-        toks = [x for x in toks if (int(x) < 256 and int(x) > 0)]
+        toks = [x for x in toks if (int(x) < 256 and int(x) >= 0)]
     except:
         return False
 


Follow ups