summaryrefslogtreecommitdiff
path: root/cloudinit/distros/parsers/hosts.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-10-11 12:49:45 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-10-11 12:49:45 -0700
commit0f1a2cbe434cba243ce65ff43a88722c2bcf6f2c (patch)
tree4f78abcde4e023878558cb066fc939ae8a12a3da /cloudinit/distros/parsers/hosts.py
parentfe1ec4d4cbb682731e8f65be5dab60f4593ed9d6 (diff)
downloadvyos-cloud-init-0f1a2cbe434cba243ce65ff43a88722c2bcf6f2c.tar.gz
vyos-cloud-init-0f1a2cbe434cba243ce65ff43a88722c2bcf6f2c.zip
More adjustments/cleanups for the system configuration
helper objects. 1. Add in a parser for the /etc/hostname file that can be shared 2. Adjust the sysconfig configobj parser to not always quote fields that it does not need to quote + add in tests around this to ensure that we don't go nuts with quoting again.
Diffstat (limited to 'cloudinit/distros/parsers/hosts.py')
-rw-r--r--cloudinit/distros/parsers/hosts.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/distros/parsers/hosts.py b/cloudinit/distros/parsers/hosts.py
index 5374ab0b..958a7c31 100644
--- a/cloudinit/distros/parsers/hosts.py
+++ b/cloudinit/distros/parsers/hosts.py
@@ -23,6 +23,7 @@ from cloudinit.distros.parsers import chop_comment
# See: man hosts
# or http://unixhelp.ed.ac.uk/CGI/man-cgi?hosts
+# or http://tinyurl.com/6lmox3
class HostsConf(object):
def __init__(self, text):
self._text = text
@@ -80,7 +81,7 @@ class HostsConf(object):
contents = StringIO()
for (line_type, components) in self._contents:
if line_type == 'blank':
- contents.write("%s\n")
+ contents.write("%s\n" % (components[0]))
elif line_type == 'all_comment':
contents.write("%s\n" % (components[0]))
elif line_type == 'option':