diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-11 12:49:45 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-11 12:49:45 -0700 |
commit | 0f1a2cbe434cba243ce65ff43a88722c2bcf6f2c (patch) | |
tree | 4f78abcde4e023878558cb066fc939ae8a12a3da /cloudinit/distros/rhel.py | |
parent | fe1ec4d4cbb682731e8f65be5dab60f4593ed9d6 (diff) | |
download | vyos-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/rhel.py')
-rw-r--r-- | cloudinit/distros/rhel.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py index 45c85fbb..039215c8 100644 --- a/cloudinit/distros/rhel.py +++ b/cloudinit/distros/rhel.py @@ -24,7 +24,8 @@ import os from cloudinit import distros -from cloudinit.distros.parsers import (resolv_conf, quoting_conf) +from cloudinit.distros.parsers.resolv_conf import ResolvConf +from cloudinit.distros.parsers.sys_conf import SysConf from cloudinit import helpers from cloudinit import log as logging @@ -63,14 +64,14 @@ class Distro(distros.Distro): self.package_command('install', pkglist) def _adjust_resolve(self, dns_servers, search_servers): - r_conf = resolv_conf.ResolvConf(util.load_file(self.resolve_conf_fn)) + r_conf = ResolvConf(util.load_file(self.resolve_conf_fn)) try: r_conf.parse() except IOError: util.logexc(LOG, "Failed at parsing %s reverting to an empty instance", self.resolve_conf_fn) - r_conf = resolv_conf.ResolvConf('') + r_conf = ResolvConf('') r_conf.parse() if dns_servers: for s in dns_servers: @@ -135,7 +136,9 @@ class Distro(distros.Distro): contents[k] = v updated_am += 1 if updated_am: - lines = contents.write() + lines = [ + str(contents), + ] if not exists: lines.insert(0, util.make_header()) util.write_file(fn, "\n".join(lines), 0644) @@ -177,7 +180,7 @@ class Distro(distros.Distro): else: contents = [] return (exists, - quoting_conf.QuotingConfigObj(contents)) + SysConf(contents)) def _bring_up_interfaces(self, device_names): if device_names and 'all' in device_names: |