diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-11-13 08:54:35 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-11-13 08:54:35 -0500 |
commit | c26b0674aa2ef31c7c3f7a0392044382cf6a452f (patch) | |
tree | b049de27577d6fe2400ef52649e6066c700f8c1c /tests/unittests/test_distros/test_netconfig.py | |
parent | 8d5e1e108b0cdd3af872383da7654bec91355b5f (diff) | |
parent | cd8fbfffdf7ba9ba79d39ee7b4a223d1bd7863b4 (diff) | |
download | vyos-cloud-init-c26b0674aa2ef31c7c3f7a0392044382cf6a452f.tar.gz vyos-cloud-init-c26b0674aa2ef31c7c3f7a0392044382cf6a452f.zip |
Use a set of helper/parsing classes to perform system configuration
Previously file modification of system configuration was done
in a functional and hard to test manner. Now instead this patch
allows for a manner that provides a nice object oriented
interface to those objects as well as makes it possible to test
those parsing entities without having to invoke distro class code.
- Created parsers for:
- /etc/sysconfig
- /etc/hostname
- resolv.conf
- /etc/hosts
Moved duplicated functionality into the root level distro class including:
- apply_hostname
- set_hostname
- *various shared configuration file names/paths*
Diffstat (limited to 'tests/unittests/test_distros/test_netconfig.py')
-rw-r--r-- | tests/unittests/test_distros/test_netconfig.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py index 55765f0c..9763b14b 100644 --- a/tests/unittests/test_distros/test_netconfig.py +++ b/tests/unittests/test_distros/test_netconfig.py @@ -9,6 +9,8 @@ from cloudinit import helpers from cloudinit import settings from cloudinit import util +from cloudinit.distros.parsers.sys_conf import SysConf + from StringIO import StringIO @@ -83,9 +85,8 @@ class TestNetCfgDistro(MockerTestCase): self.assertEquals(write_buf.mode, 0644) def assertCfgEquals(self, blob1, blob2): - cfg_tester = distros.rhel.QuotingConfigObj - b1 = dict(cfg_tester(blob1.strip().splitlines())) - b2 = dict(cfg_tester(blob2.strip().splitlines())) + b1 = dict(SysConf(blob1.strip().splitlines())) + b2 = dict(SysConf(blob2.strip().splitlines())) self.assertEquals(b1, b2) for (k, v) in b1.items(): self.assertIn(k, b2) |