summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlastimil Holer <vlastimil.holer@gmail.com>2014-01-28 14:15:20 -0500
committerScott Moser <smoser@ubuntu.com>2014-01-28 14:15:20 -0500
commit06c80d8b0dcb8cf1013885fc745bf48d57b39ce4 (patch)
tree30715a23e7b6d5f15c746167302e86082e460b55
parent0be4922d92e874b2e3300bdde65829cdb6569524 (diff)
parent7659f06379122218e11ef445cd1f435ea5e74f40 (diff)
downloadvyos-cloud-init-06c80d8b0dcb8cf1013885fc745bf48d57b39ce4.tar.gz
vyos-cloud-init-06c80d8b0dcb8cf1013885fc745bf48d57b39ce4.zip
util.is_ipv4: realize that 0 is a valid number in a ipv4 address.
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". Fixes for SmartOS datasource 1. fixed conflation of user-data and cloud-init user-data. Cloud-init user-data is now namespaced as 'cloud-init:user-data'. 2. user-scripts (not user-data) are now fetched from the meta-data service each boot and executed as in the scripts directory 3. datacenter name is now namespaced as sdc:datacenter 4. user-scripts will now have '#!/bin/bash' magically prepended if the 'file' thinks its plain text and it does not start with '#!' read_file_or_url: raise UrlError with 404 on ENOENT This makes it easier to call read_file_or_url and handle file or url errors. Now read_file_or_url will raise a UrlError in either case on errors.
-rw-r--r--ChangeLog1
-rw-r--r--cloudinit/util.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e547426e..63d1d62e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
- configdrive: consider partitions as possible datasources if they have
theh correct filesystem label. [Paul Querna]
- initial freebsd support [Harm Weites]
+ - fix in is_ipv4 to accept IP addresses with a '0' in them.
0.7.4:
- fix issue mounting 'ephemeral0' if ephemeral0 was an alias for a
partitioned block device with target filesystem on ephemeral0.1.
diff --git a/cloudinit/util.py b/cloudinit/util.py
index b3332acd..61bcdeb1 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -369,7 +369,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 (int(x) < 256 and int(x) >= 0)]
except:
return False