diff options
author | Vlastimil Holer <vlastimil.holer@gmail.com> | 2012-09-20 18:39:54 +0200 |
---|---|---|
committer | Vlastimil Holer <vlastimil.holer@gmail.com> | 2012-09-20 18:39:54 +0200 |
commit | 17ac62b5d4d0cb3f25f431ff85411a7cca860d12 (patch) | |
tree | 5be41e97f7e7af1d1c3c6ea0d33da91b7ef7bf6c /cloudinit/sources/__init__.py | |
parent | 0659e75ee2a2c25c113e8e652a3366433e76eff0 (diff) | |
download | vyos-cloud-init-17ac62b5d4d0cb3f25f431ff85411a7cca860d12.tar.gz vyos-cloud-init-17ac62b5d4d0cb3f25f431ff85411a7cca860d12.zip |
Initialize toks variable. Fix EC2-like hostname generation based on IPv4.
Diffstat (limited to 'cloudinit/sources/__init__.py')
-rw-r--r-- | cloudinit/sources/__init__.py | 3 |
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(".") |