summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 9b68f99e..a89f4703 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -173,13 +173,14 @@ class DataSource(object):
# make up a hostname (LP: #475354) in format ip-xx.xx.xx.xx
lhost = self.metadata['local-hostname']
if util.is_ipv4(lhost):
+ toks = []
if resolve_ip:
toks = util.gethostbyaddr(lhost)
if toks:
toks = toks.split('.')
else:
- toks = "ip-%s" % lhost.replace(".", "-")
+ toks = ["ip-%s" % lhost.replace(".", "-")]
else:
toks = lhost.split(".")