diff options
| author | Joshua Harlow <harlowja@gmail.com> | 2016-05-10 13:18:53 -0700 | 
|---|---|---|
| committer | Joshua Harlow <harlowja@gmail.com> | 2016-05-10 13:18:53 -0700 | 
| commit | cc56ef479a4cfa4520dfcc7cc27c35bb6ac86bd2 (patch) | |
| tree | 0ecc3ec1832b52fb64bc4fc0fdb3593943874493 | |
| parent | 483545957dca362452b94fc49064e298fc07dd71 (diff) | |
| download | vyos-cloud-init-cc56ef479a4cfa4520dfcc7cc27c35bb6ac86bd2.tar.gz vyos-cloud-init-cc56ef479a4cfa4520dfcc7cc27c35bb6ac86bd2.zip  | |
Fix up tests and debian distro
| -rw-r--r-- | cloudinit/distros/debian.py | 4 | ||||
| -rw-r--r-- | tests/unittests/test_net.py | 23 | 
2 files changed, 14 insertions, 13 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py index 21a4f805..465413a8 100644 --- a/cloudinit/distros/debian.py +++ b/cloudinit/distros/debian.py @@ -27,7 +27,7 @@ from cloudinit import helpers  from cloudinit import log as logging  from cloudinit import util  from cloudinit import net -from cloudinit.net.distros import debian +from cloudinit.net.renderers import eni  from cloudinit.distros.parsers.hostname import HostnameConf @@ -57,7 +57,7 @@ class Distro(distros.Distro):          # should only happen say once per instance...)          self._runner = helpers.Runners(paths)          self.osfamily = 'debian' -        self._net_renderer = debian.Renderer() +        self._net_renderer = eni.Renderer()      def apply_locale(self, locale, out_fn=None):          if not out_fn: diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py index a0cdc493..6daf9601 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -1,5 +1,6 @@  from cloudinit import util  from cloudinit import net +from cloudinit.net import cmdline  from .helpers import TestCase  import base64 @@ -74,15 +75,15 @@ class TestNetConfigParsing(TestCase):                      "mac_address": "c0:d6:9f:2c:e8:80",                      "subnets": [{"type": "dhcp"}]}]} -    def test_klibc_convert_dhcp(self): -        found = net._klibc_to_config_entry(DHCP_CONTENT_1) +    def test_cmdline_convert_dhcp(self): +        found = cmdline._klibc_to_config_entry(DHCP_CONTENT_1)          self.assertEqual(found, ('eth0', DHCP_EXPECTED_1)) -    def test_klibc_convert_static(self): -        found = net._klibc_to_config_entry(STATIC_CONTENT_1) +    def test_cmdline_convert_static(self): +        found = cmdline._klibc_to_config_entry(STATIC_CONTENT_1)          self.assertEqual(found, ('eth1', STATIC_EXPECTED_1)) -    def test_config_from_klibc_net_cfg(self): +    def test_config_from_cmdline_net_cfg(self):          files = []          pairs = (('net-eth0.cfg', DHCP_CONTENT_1),                   ('net-eth1.cfg', STATIC_CONTENT_1)) @@ -103,25 +104,25 @@ class TestNetConfigParsing(TestCase):                  files.append(fp)                  util.write_file(fp, content) -            found = net.config_from_klibc_net_cfg(files=files, mac_addrs=macs) +            found = cmdline.config_from_klibc_net_cfg(files=files, +                                                      mac_addrs=macs)              self.assertEqual(found, expected)      def test_cmdline_with_b64(self):          data = base64.b64encode(json.dumps(self.simple_cfg).encode())          encoded_text = data.decode() -        cmdline = 'ro network-config=' + encoded_text + ' root=foo' -        found = net.read_kernel_cmdline_config(cmdline=cmdline) +        raw_cmdline = 'ro network-config=' + encoded_text + ' root=foo' +        found = cmdline.read_kernel_cmdline_config(cmdline=raw_cmdline)          self.assertEqual(found, self.simple_cfg)      def test_cmdline_with_b64_gz(self):          data = _gzip_data(json.dumps(self.simple_cfg).encode())          encoded_text = base64.b64encode(data).decode() -        cmdline = 'ro network-config=' + encoded_text + ' root=foo' -        found = net.read_kernel_cmdline_config(cmdline=cmdline) +        raw_cmdline = 'ro network-config=' + encoded_text + ' root=foo' +        found = cmdline.read_kernel_cmdline_config(cmdline=raw_cmdline)          self.assertEqual(found, self.simple_cfg) -  def _gzip_data(data):      with io.BytesIO() as iobuf:          gzfp = gzip.GzipFile(mode="wb", fileobj=iobuf)  | 
