← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:bug/net-explicit-lo-type into cloud-init:master

 

see inline comments

Diff comments:

> diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
> index 06de660..7f52db4 100644
> --- a/cloudinit/net/sysconfig.py
> +++ b/cloudinit/net/sysconfig.py
> @@ -368,6 +368,8 @@ class Renderer(renderer.Renderer):
>          '''Given state, return /etc/sysconfig files + contents'''
>          iface_contents = {}
>          for iface in network_state.iter_interfaces():
> +            if iface['type'] == "loopback":
> +                continue

Does'nt this make it skip ever rendering an ifcfg-lo ?

>              iface_name = iface['name']
>              iface_cfg = NetInterface(iface_name, base_sysconf_dir)
>              cls._render_iface_shared(iface, iface_cfg)
> diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
> index 8d25310..c6535e1 100644
> --- a/tests/unittests/test_net.py
> +++ b/tests/unittests/test_net.py
> @@ -722,6 +730,27 @@ USERCTL=no
>                  with open(os.path.join(render_dir, fn)) as fh:
>                      self.assertEqual(expected_content, fh.read())
>  
> +    def test_config_with_explicit_loopback(self):
> +        ns = network_state.parse_net_config_data(CONFIG_V1_EXPLICIT_LOOPBACK)
> +        render_dir = self.tmp_path("render")
> +        os.makedirs(render_dir)
> +        renderer = sysconfig.Renderer()
> +        renderer.render_network_state(render_dir, ns)
> +        found = dir2dict(render_dir)
> +        nspath = '/etc/sysconfig/network-scripts/'
> +        self.assertNotIn(nspath + 'ifcfg-lo', found.keys())

and doesnt this specifically assert that we do not write it ?

> +        expected = """\
> +# Created by cloud-init on instance boot automatically, do not edit.
> +#
> +BOOTPROTO=dhcp
> +DEVICE=eth0
> +NM_CONTROLLED=no
> +ONBOOT=yes
> +TYPE=Ethernet
> +USERCTL=no
> +"""
> +        self.assertEqual(expected, found[nspath + 'ifcfg-eth0'])
> +
>  
>  class TestEniNetRendering(CiTestCase):
>  


-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/319943
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/net-explicit-lo-type into cloud-init:master.


References