#12 Rebase to 20.4
Merged 3 years ago by otubo. Opened 3 years ago by otubo.
rpms/ otubo/cloud-init rebase_20.4  into  master

@@ -1,107 +0,0 @@ 

- From 9e3ac98097ed1c7f49ec8975a40aec7229231aae Mon Sep 17 00:00:00 2001

- From: Louis Bouchard <bouchard.louis@gmail.com>

- Date: Wed, 29 Jan 2020 16:55:09 +0100

- Subject: [PATCH] Scaleway: Fix DatasourceScaleway to avoid backtrace (#128)

- 

- Make sure network_config is created when self._network_config is unset.

- 

- Co-authored-by: Scott Moser <smoser@brickies.net>

- ---

-  cloudinit/sources/DataSourceScaleway.py       |  9 +++-

-  .../test_datasource/test_scaleway.py          | 49 +++++++++++++++++++

-  2 files changed, 56 insertions(+), 2 deletions(-)

- 

- diff --git a/cloudinit/sources/DataSourceScaleway.py b/cloudinit/sources/DataSourceScaleway.py

- index b573b382..83c2bf65 100644

- --- a/cloudinit/sources/DataSourceScaleway.py

- +++ b/cloudinit/sources/DataSourceScaleway.py

- @@ -188,7 +188,7 @@ class DataSourceScaleway(sources.DataSource):

-          self.retries = int(self.ds_cfg.get('retries', DEF_MD_RETRIES))

-          self.timeout = int(self.ds_cfg.get('timeout', DEF_MD_TIMEOUT))

-          self._fallback_interface = None

- -        self._network_config = None

- +        self._network_config = sources.UNSET

-  

-      def _crawl_metadata(self):

-          resp = url_helper.readurl(self.metadata_address,

- @@ -227,7 +227,12 @@ class DataSourceScaleway(sources.DataSource):

-          Configure networking according to data received from the

-          metadata API.

-          """

- -        if self._network_config:

- +        if self._network_config is None:

- +            LOG.warning('Found None as cached _network_config. '

- +                        'Resetting to %s', sources.UNSET)

- +            self._network_config = sources.UNSET

- +

- +        if self._network_config != sources.UNSET:

-              return self._network_config

-  

-          if self._fallback_interface is None:

- diff --git a/tests/unittests/test_datasource/test_scaleway.py b/tests/unittests/test_datasource/test_scaleway.py

- index f96bf0a2..1b4dd0ad 100644

- --- a/tests/unittests/test_datasource/test_scaleway.py

- +++ b/tests/unittests/test_datasource/test_scaleway.py

- @@ -7,6 +7,7 @@ import requests

-  

-  from cloudinit import helpers

-  from cloudinit import settings

- +from cloudinit import sources

-  from cloudinit.sources import DataSourceScaleway

-  

-  from cloudinit.tests.helpers import mock, HttprettyTestCase, CiTestCase

- @@ -403,3 +404,51 @@ class TestDataSourceScaleway(HttprettyTestCase):

-  

-          netcfg = self.datasource.network_config

-          self.assertEqual(netcfg, '0xdeadbeef')

- +

- +    @mock.patch('cloudinit.sources.DataSourceScaleway.net.find_fallback_nic')

- +    @mock.patch('cloudinit.util.get_cmdline')

- +    def test_network_config_unset(self, m_get_cmdline, fallback_nic):

- +        """

- +        _network_config will be set to sources.UNSET after the first boot.

- +        Make sure it behave correctly.

- +        """

- +        m_get_cmdline.return_value = 'scaleway'

- +        fallback_nic.return_value = 'ens2'

- +        self.datasource.metadata['ipv6'] = None

- +        self.datasource._network_config = sources.UNSET

- +

- +        resp = {'version': 1,

- +                'config': [{

- +                     'type': 'physical',

- +                     'name': 'ens2',

- +                     'subnets': [{'type': 'dhcp4'}]}]

- +                }

- +

- +        netcfg = self.datasource.network_config

- +        self.assertEqual(netcfg, resp)

- +

- +    @mock.patch('cloudinit.sources.DataSourceScaleway.LOG.warning')

- +    @mock.patch('cloudinit.sources.DataSourceScaleway.net.find_fallback_nic')

- +    @mock.patch('cloudinit.util.get_cmdline')

- +    def test_network_config_cached_none(self, m_get_cmdline, fallback_nic,

- +                                        logwarning):

- +        """

- +        network_config() should return config data if cached data is None

- +        rather than sources.UNSET

- +        """

- +        m_get_cmdline.return_value = 'scaleway'

- +        fallback_nic.return_value = 'ens2'

- +        self.datasource.metadata['ipv6'] = None

- +        self.datasource._network_config = None

- +

- +        resp = {'version': 1,

- +                'config': [{

- +                     'type': 'physical',

- +                     'name': 'ens2',

- +                     'subnets': [{'type': 'dhcp4'}]}]

- +                }

- +

- +        netcfg = self.datasource.network_config

- +        self.assertEqual(netcfg, resp)

- +        logwarning.assert_called_with('Found None as cached _network_config. '

- +                                      'Resetting to %s', sources.UNSET)

- -- 

- 2.18.1

- 

@@ -1,28 +0,0 @@ 

- From 42788bf24a1a0a5421a2d00a7f59b59e38ba1a14 Mon Sep 17 00:00:00 2001

- From: Ryan Harper <ryan.harper@canonical.com>

- Date: Fri, 24 Jan 2020 21:33:12 +0200

- Subject: [PATCH] cc_set_password: increase random pwlength from 9 to 20 (#189)

- 

- Increasing the bits of security from 52 to 115.

- 

- LP: #1860795

- ---

-  cloudinit/config/cc_set_passwords.py | 2 +-

-  1 file changed, 1 insertion(+), 1 deletion(-)

- 

- diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py

- index e3b39d8b..4943d545 100755

- --- a/cloudinit/config/cc_set_passwords.py

- +++ b/cloudinit/config/cc_set_passwords.py

- @@ -236,7 +236,7 @@ def handle(_name, cfg, cloud, log, args):

-          raise errors[-1]

-  

-  

- -def rand_user_password(pwlen=9):

- +def rand_user_password(pwlen=20):

-      return util.rand_str(pwlen, select_from=PW_SET)

-  

-  

- -- 

- 2.18.1

- 

@@ -1,540 +0,0 @@ 

- From 98657d64a1d40769b31fcf375ebb1ea0b373350c Mon Sep 17 00:00:00 2001

- From: Eduardo Otubo <otubo@redhat.com>

- Date: Fri, 21 Feb 2020 11:10:09 +0100

- Subject: [PATCH] Do not write NM_CONTROLLED=no in generated interface config 

-  files

- 

- Signed-off-by: Eduardo Otubo <otubo@redhat.com>

- ---

-  cloudinit/net/sysconfig.py                    |  1 -

-  .../unittests/test_distros/test_netconfig.py  |  8 ---

-  tests/unittests/test_net.py                   | 55 -------------------

-  3 files changed, 64 deletions(-)

- 

- diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py

- index 310cdf01..8bd7e887 100644

- --- a/cloudinit/net/sysconfig.py

- +++ b/cloudinit/net/sysconfig.py

- @@ -272,7 +272,6 @@ class Renderer(renderer.Renderer):

-      iface_defaults = tuple([

-          ('ONBOOT', True),

-          ('USERCTL', False),

- -        ('NM_CONTROLLED', False),

-          ('BOOTPROTO', 'none'),

-          ('STARTMODE', 'auto'),

-      ])

- diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py

- index 67209955..1df3bfb5 100644

- --- a/tests/unittests/test_distros/test_netconfig.py

- +++ b/tests/unittests/test_distros/test_netconfig.py

- @@ -466,7 +466,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

-                  GATEWAY=192.168.1.254

-                  IPADDR=192.168.1.5

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -475,7 +474,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

-              self.ifcfg_path('eth1'): dedent("""\

-                  BOOTPROTO=dhcp

-                  DEVICE=eth1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -500,7 +498,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

-                  IPV6ADDR=2607:f0d0:1002:0011::2/64

-                  IPV6INIT=yes

-                  IPV6_DEFAULTGW=2607:f0d0:1002:0011::1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -509,7 +506,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

-              self.ifcfg_path('eth1'): dedent("""\

-                  BOOTPROTO=dhcp

-                  DEVICE=eth1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -562,7 +558,6 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):

-                  GATEWAY=192.168.1.254

-                  IPADDR=192.168.1.5

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -571,7 +566,6 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):

-              self.ifcfg_path('eth1'): dedent("""\

-                  BOOTPROTO=dhcp

-                  DEVICE=eth1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -593,7 +587,6 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):

-                  IPV6ADDR=2607:f0d0:1002:0011::2/64

-                  IPV6INIT=yes

-                  IPV6_DEFAULTGW=2607:f0d0:1002:0011::1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -602,7 +595,6 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):

-              self.ifcfg_path('eth1'): dedent("""\

-                  BOOTPROTO=dhcp

-                  DEVICE=eth1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py

- index 01119e0a..40427461 100644

- --- a/tests/unittests/test_net.py

- +++ b/tests/unittests/test_net.py

- @@ -496,7 +496,6 @@ GATEWAY=172.19.3.254

-  HWADDR=fa:16:3e:ed:9a:59

-  IPADDR=172.19.1.34

-  NETMASK=255.255.252.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -530,7 +529,6 @@ GATEWAY=172.19.3.254

-  HWADDR=fa:16:3e:ed:9a:59

-  IPADDR=172.19.1.34

-  NETMASK=255.255.252.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -600,7 +598,6 @@ IPADDR=172.19.1.34

-  IPADDR1=10.0.0.10

-  NETMASK=255.255.252.0

-  NETMASK1=255.255.255.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -636,7 +633,6 @@ IPADDR=172.19.1.34

-  IPADDR1=10.0.0.10

-  NETMASK=255.255.252.0

-  NETMASK1=255.255.255.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -731,7 +727,6 @@ IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"

-  IPV6INIT=yes

-  IPV6_DEFAULTGW=2001:DB8::1

-  NETMASK=255.255.252.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -772,7 +767,6 @@ IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"

-  IPV6INIT=yes

-  IPV6_DEFAULTGW=2001:DB8::1

-  NETMASK=255.255.252.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -889,7 +883,6 @@ NETWORK_CONFIGS = {

-                  BOOTPROTO=none

-                  DEVICE=eth1

-                  HWADDR=cf:d6:af:48:e8:80

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -907,7 +900,6 @@ NETWORK_CONFIGS = {

-                  IPADDR=192.168.21.3

-                  NETMASK=255.255.255.0

-                  METRIC=10000

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1022,7 +1014,6 @@ NETWORK_CONFIGS = {

-                  IPV6ADDR=2001:1::1/64

-                  IPV6INIT=yes

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1062,7 +1053,6 @@ NETWORK_CONFIGS = {

-                  DHCPV6C=yes

-                  IPV6INIT=yes

-                  DEVICE=iface0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1111,7 +1101,6 @@ NETWORK_CONFIGS = {

-                  IPV6INIT=yes

-                  IPV6_FORCE_ACCEPT_RA=yes

-                  DEVICE=iface0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1160,7 +1149,6 @@ NETWORK_CONFIGS = {

-                  IPV6INIT=yes

-                  IPV6_FORCE_ACCEPT_RA=no

-                  DEVICE=iface0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1199,7 +1187,6 @@ NETWORK_CONFIGS = {

-                  IPV6_AUTOCONF=yes

-                  IPV6INIT=yes

-                  DEVICE=iface0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1240,7 +1227,6 @@ NETWORK_CONFIGS = {

-              IPV6_AUTOCONF=yes

-              IPV6INIT=yes

-              DEVICE=iface0

- -            NM_CONTROLLED=no

-              ONBOOT=yes

-              STARTMODE=auto

-              TYPE=Ethernet

- @@ -1281,7 +1267,6 @@ NETWORK_CONFIGS = {

-              IPV6INIT=yes

-              IPV6_FORCE_ACCEPT_RA=yes

-              DEVICE=iface0

- -            NM_CONTROLLED=no

-              ONBOOT=yes

-              STARTMODE=auto

-              TYPE=Ethernet

- @@ -1491,7 +1476,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  DHCPV6C=yes

-                  IPV6INIT=yes

-                  MACADDR=aa:bb:cc:dd:ee:ff

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Bond

- @@ -1500,7 +1484,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  BOOTPROTO=dhcp

-                  DEVICE=bond0.200

-                  DHCLIENT_SET_DEFAULT_ROUTE=no

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  PHYSDEV=bond0

-                  STARTMODE=auto

- @@ -1519,7 +1502,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  IPV6_DEFAULTGW=2001:4800:78ff:1b::1

-                  MACADDR=bb:bb:bb:bb:bb:aa

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  PRIO=22

-                  STARTMODE=auto

- @@ -1530,7 +1512,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  BOOTPROTO=none

-                  DEVICE=eth0

-                  HWADDR=c0:d6:9f:2c:e8:80

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1548,7 +1529,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  MTU=1500

-                  NETMASK=255.255.255.0

-                  NETMASK1=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  PHYSDEV=eth0

-                  STARTMODE=auto

- @@ -1560,7 +1540,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  DEVICE=eth1

-                  HWADDR=aa:d6:9f:2c:e8:80

-                  MASTER=bond0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  SLAVE=yes

- @@ -1571,7 +1550,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  DEVICE=eth2

-                  HWADDR=c0:bb:9f:2c:e8:80

-                  MASTER=bond0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  SLAVE=yes

- @@ -1582,7 +1560,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  BRIDGE=br0

-                  DEVICE=eth3

-                  HWADDR=66:bb:9f:2c:e8:80

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1592,7 +1569,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  BRIDGE=br0

-                  DEVICE=eth4

-                  HWADDR=98:bb:9f:2c:e8:80

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -1602,7 +1578,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  DEVICE=eth5

-                  DHCLIENT_SET_DEFAULT_ROUTE=no

-                  HWADDR=98:bb:9f:2c:e8:8a

- -                NM_CONTROLLED=no

-                  ONBOOT=no

-                  STARTMODE=manual

-                  TYPE=Ethernet

- @@ -1614,7 +1589,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

-                  IPADDR=192.168.200.7

-                  MTU=9000

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=InfiniBand

- @@ -2027,7 +2001,6 @@ iface bond0 inet6 static

-          MTU=9000

-          NETMASK=255.255.255.0

-          NETMASK1=255.255.255.0

- -        NM_CONTROLLED=no

-          ONBOOT=yes

-          STARTMODE=auto

-          TYPE=Bond

- @@ -2038,7 +2011,6 @@ iface bond0 inet6 static

-          DEVICE=bond0s0

-          HWADDR=aa:bb:cc:dd:e8:00

-          MASTER=bond0

- -        NM_CONTROLLED=no

-          ONBOOT=yes

-          SLAVE=yes

-          STARTMODE=auto

- @@ -2055,7 +2027,6 @@ iface bond0 inet6 static

-          DEVICE=bond0s1

-          HWADDR=aa:bb:cc:dd:e8:01

-          MASTER=bond0

- -        NM_CONTROLLED=no

-          ONBOOT=yes

-          SLAVE=yes

-          STARTMODE=auto

- @@ -2088,7 +2059,6 @@ iface bond0 inet6 static

-          MTU=9000

-          NETMASK=255.255.255.0

-          NETMASK1=255.255.255.0

- -        NM_CONTROLLED=no

-          ONBOOT=yes

-          STARTMODE=auto

-          TYPE=Bond

- @@ -2099,7 +2069,6 @@ iface bond0 inet6 static

-          DEVICE=bond0s0

-          HWADDR=aa:bb:cc:dd:e8:00

-          MASTER=bond0

- -        NM_CONTROLLED=no

-          ONBOOT=yes

-          SLAVE=yes

-          STARTMODE=auto

- @@ -2122,7 +2091,6 @@ iface bond0 inet6 static

-          DEVICE=bond0s1

-          HWADDR=aa:bb:cc:dd:e8:01

-          MASTER=bond0

- -        NM_CONTROLLED=no

-          ONBOOT=yes

-          SLAVE=yes

-          STARTMODE=auto

- @@ -2161,7 +2129,6 @@ iface bond0 inet6 static

-                  BOOTPROTO=none

-                  DEVICE=en0

-                  HWADDR=aa:bb:cc:dd:e8:00

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -2180,7 +2147,6 @@ iface bond0 inet6 static

-                  MTU=2222

-                  NETMASK=255.255.255.0

-                  NETMASK1=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  PHYSDEV=en0

-                  STARTMODE=auto

- @@ -2222,7 +2188,6 @@ iface bond0 inet6 static

-                  DEVICE=br0

-                  IPADDR=192.168.2.2

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  PRIO=22

-                  STARTMODE=auto

- @@ -2238,7 +2203,6 @@ iface bond0 inet6 static

-                  IPADDR6=2001:1::100/96

-                  IPV6ADDR=2001:1::100/96

-                  IPV6INIT=yes

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -2252,7 +2216,6 @@ iface bond0 inet6 static

-                  IPADDR6=2001:1::101/96

-                  IPV6ADDR=2001:1::101/96

-                  IPV6INIT=yes

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -2327,7 +2290,6 @@ iface bond0 inet6 static

-                  HWADDR=52:54:00:12:34:00

-                  IPADDR=192.168.1.2

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=no

-                  STARTMODE=manual

-                  TYPE=Ethernet

- @@ -2338,7 +2300,6 @@ iface bond0 inet6 static

-                  DEVICE=eth1

-                  HWADDR=52:54:00:12:34:aa

-                  MTU=1480

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -2348,7 +2309,6 @@ iface bond0 inet6 static

-                  BOOTPROTO=none

-                  DEVICE=eth2

-                  HWADDR=52:54:00:12:34:ff

- -                NM_CONTROLLED=no

-                  ONBOOT=no

-                  STARTMODE=manual

-                  TYPE=Ethernet

- @@ -2766,7 +2726,6 @@ class TestRhelSysConfigRendering(CiTestCase):

-  BOOTPROTO=dhcp

-  DEVICE=eth1000

-  HWADDR=07-1c-c6-75-a4-be

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -2888,7 +2847,6 @@ GATEWAY=10.0.2.2

-  HWADDR=52:54:00:12:34:00

-  IPADDR=10.0.2.15

-  NETMASK=255.255.255.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -2920,7 +2878,6 @@ HWADDR=fa:16:3e:25:b4:59

-  IPADDR=51.68.89.122

-  MTU=1500

-  NETMASK=255.255.240.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -2935,7 +2892,6 @@ DEVICE=eth1

-  DHCLIENT_SET_DEFAULT_ROUTE=no

-  HWADDR=fa:16:3e:b1:ca:29

-  MTU=9000

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -2961,7 +2917,6 @@ USERCTL=no

-  #

-  BOOTPROTO=dhcp

-  DEVICE=eth0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -3168,7 +3123,6 @@ USERCTL=no

-                     IPV6INIT=yes

-                     IPV6_DEFAULTGW=2001:db8::1

-                     NETMASK=255.255.255.0

- -                   NM_CONTROLLED=no

-                     ONBOOT=yes

-                     STARTMODE=auto

-                     TYPE=Ethernet

- @@ -3194,7 +3148,6 @@ USERCTL=no

-              'ifcfg-eno1': textwrap.dedent("""\

-                  BOOTPROTO=none

-                  DEVICE=eno1

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -3206,7 +3159,6 @@ USERCTL=no

-                  IPADDR=192.6.1.9

-                  MTU=1495

-                  NETMASK=255.255.255.0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  PHYSDEV=eno1

-                  STARTMODE=auto

- @@ -3238,7 +3190,6 @@ USERCTL=no

-                  IPADDR=10.101.8.65

-                  MTU=1334

-                  NETMASK=255.255.255.192

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Bond

- @@ -3249,7 +3200,6 @@ USERCTL=no

-                  BOOTPROTO=none

-                  DEVICE=enp0s0

-                  MASTER=bond0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  SLAVE=yes

-                  STARTMODE=auto

- @@ -3261,7 +3211,6 @@ USERCTL=no

-                  BOOTPROTO=none

-                  DEVICE=enp0s1

-                  MASTER=bond0

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  SLAVE=yes

-                  STARTMODE=auto

- @@ -3286,7 +3235,6 @@ USERCTL=no

-                  DEVICE=eno1

-                  HWADDR=07-1c-c6-75-a4-be

-                  METRIC=100

- -                NM_CONTROLLED=no

-                  ONBOOT=yes

-                  STARTMODE=auto

-                  TYPE=Ethernet

- @@ -3386,7 +3334,6 @@ class TestOpenSuseSysConfigRendering(CiTestCase):

-  BOOTPROTO=dhcp

-  DEVICE=eth1000

-  HWADDR=07-1c-c6-75-a4-be

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -3508,7 +3455,6 @@ GATEWAY=10.0.2.2

-  HWADDR=52:54:00:12:34:00

-  IPADDR=10.0.2.15

-  NETMASK=255.255.255.0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- @@ -3538,7 +3484,6 @@ USERCTL=no

-  #

-  BOOTPROTO=dhcp

-  DEVICE=eth0

- -NM_CONTROLLED=no

-  ONBOOT=yes

-  STARTMODE=auto

-  TYPE=Ethernet

- -- 

- 2.17.2

- 

@@ -1,31 +0,0 @@ 

- From 3e2f7356effc9e9cccc5ae945846279804eedc46 Mon Sep 17 00:00:00 2001

- From: Dimitri John Ledkov <xnox@ubuntu.com>

- Date: Tue, 18 Feb 2020 17:03:24 +0000

- Subject: [PATCH] utils: use SystemRandom when generating random password.

-  (#204)

- 

- As noticed by Seth Arnold, non-deterministic SystemRandom should be

- used when creating security sensitive random strings.

- ---

-  cloudinit/util.py | 3 ++-

-  1 file changed, 2 insertions(+), 1 deletion(-)

- 

- diff --git a/cloudinit/util.py b/cloudinit/util.py

- index d99e82fa..c02b3d9a 100644

- --- a/cloudinit/util.py

- +++ b/cloudinit/util.py

- @@ -397,9 +397,10 @@ def translate_bool(val, addons=None):

-  

-  

-  def rand_str(strlen=32, select_from=None):

- +    r = random.SystemRandom()

-      if not select_from:

-          select_from = string.ascii_letters + string.digits

- -    return "".join([random.choice(select_from) for _x in range(0, strlen)])

- +    return "".join([r.choice(select_from) for _x in range(0, strlen)])

-  

-  

-  def rand_dict_key(dictionary, postfix=None):

- -- 

- 2.18.1

- 

cloud-init-20.4-disable-lxd-tests.patch cloud-init-19.4-disable-lxd-tests.patch
file renamed
+8 -7
@@ -1,7 +1,7 @@ 

- From 1a8143951839afd5b0f80e9d00af582daa429fdc Mon Sep 17 00:00:00 2001

+ From f70a9a0a98c0af5a7b2aea9a8e4b40bbe1668038 Mon Sep 17 00:00:00 2001

  From: Eduardo Otubo <otubo@redhat.com>

- Date: Fri, 21 Feb 2020 10:52:26 +0100

- Subject: [PATCH] Disable LXD tests

+ Date: Thu, 3 Dec 2020 12:31:42 +0100

+ Subject: [PATCH 1/3] Disable LXD tests

  

  Signed-off-by: Eduardo Otubo <otubo@redhat.com>

  ---
@@ -9,17 +9,18 @@ 

   1 file changed, 2 deletions(-)

  

  diff --git a/tests/cloud_tests/platforms/__init__.py b/tests/cloud_tests/platforms/__init__.py

- index 6a410b84..2076d1c7 100644

+ index e506baa0..e7efcba5 100644

  --- a/tests/cloud_tests/platforms/__init__.py

  +++ b/tests/cloud_tests/platforms/__init__.py

- @@ -3,14 +3,12 @@

+ @@ -3,7 +3,6 @@

   """Main init."""

   

   from .ec2 import platform as ec2

  -from .lxd import platform as lxd

   from .nocloudkvm import platform as nocloudkvm

   from .azurecloud import platform as azurecloud

-  

+  from ..util import emit_dots_on_travis

+ @@ -11,7 +10,6 @@ from ..util import emit_dots_on_travis

   PLATFORMS = {

       'ec2': ec2.EC2Platform,

       'nocloud-kvm': nocloudkvm.NoCloudKVMPlatform,
@@ -28,5 +29,5 @@ 

   }

   

  -- 

- 2.17.2

+ 2.27.0

  

@@ -0,0 +1,500 @@ 

+ From 8256852de570a0c6b237c75abd134ddbafee5c1f Mon Sep 17 00:00:00 2001

+ From: Eduardo Otubo <otubo@redhat.com>

+ Date: Thu, 3 Dec 2020 12:31:50 +0100

+ Subject: [PATCH] Do not write NM_CONTROLLED=no in generated interface config 

+  files

+ 

+ Conflicts 20.3:

+  - Not appplying patch on cloudinit/net/sysconfig.py since it now has a

+ mechanism to identify if cloud-init is running on RHEL, having the

+ correct settings for NM_CONTROLLED.

+ 

+ X-downstream-only: true

+ Signed-off-by: Eduardo Otubo <otubo@redhat.com>

+ Signed-off-by: Ryan McCabe <rmccabe@redhat.com>

+ ---

+  cloudinit/net/sysconfig.py                    |  2 +-

+  .../unittests/test_distros/test_netconfig.py  |  8 ---

+  tests/unittests/test_net.py                   | 49 -------------------

+  3 files changed, 1 insertion(+), 58 deletions(-)

+ 

+ diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py

+ index a930e612..9c822c3e 100644

+ --- a/cloudinit/net/sysconfig.py

+ +++ b/cloudinit/net/sysconfig.py

+ @@ -289,7 +289,7 @@ class Renderer(renderer.Renderer):

+      #                                         details about this)

+  

+      iface_defaults = {

+ -        'rhel': {'ONBOOT': True, 'USERCTL': False, 'NM_CONTROLLED': False,

+ +        'rhel': {'ONBOOT': True, 'USERCTL': False,

+                   'BOOTPROTO': 'none'},

+          'suse': {'BOOTPROTO': 'static', 'STARTMODE': 'auto'},

+      }

+ diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py

+ index a1df066a..bc167f94 100644

+ --- a/tests/unittests/test_distros/test_netconfig.py

+ +++ b/tests/unittests/test_distros/test_netconfig.py

+ @@ -484,7 +484,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+                  GATEWAY=192.168.1.254

+                  IPADDR=192.168.1.5

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -492,7 +491,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+              self.ifcfg_path('eth1'): dedent("""\

+                  BOOTPROTO=dhcp

+                  DEVICE=eth1

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -517,7 +515,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+                  IPV6_AUTOCONF=no

+                  IPV6_DEFAULTGW=2607:f0d0:1002:0011::1

+                  IPV6_FORCE_ACCEPT_RA=no

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -525,7 +522,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+              self.ifcfg_path('eth1'): dedent("""\

+                  BOOTPROTO=dhcp

+                  DEVICE=eth1

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -559,7 +555,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+                  HWADDR=00:16:3e:60:7c:df

+                  IPADDR=192.10.1.2

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -569,7 +564,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+                  DEVICE=infra0

+                  IPADDR=10.0.1.2

+                  NETMASK=255.255.0.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PHYSDEV=eth0

+                  USERCTL=no

+ @@ -598,7 +592,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+                  DEVICE=eth0

+                  IPADDR=192.10.1.2

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -608,7 +601,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):

+                  DEVICE=eth0.1001

+                  IPADDR=10.0.1.2

+                  NETMASK=255.255.0.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PHYSDEV=eth0

+                  USERCTL=no

+ diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py

+ index 70453683..47a71964 100644

+ --- a/tests/unittests/test_net.py

+ +++ b/tests/unittests/test_net.py

+ @@ -535,7 +535,6 @@ GATEWAY=172.19.3.254

+  HWADDR=fa:16:3e:ed:9a:59

+  IPADDR=172.19.1.34

+  NETMASK=255.255.252.0

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -633,7 +632,6 @@ IPADDR=172.19.1.34

+  IPADDR1=10.0.0.10

+  NETMASK=255.255.252.0

+  NETMASK1=255.255.255.0

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -756,7 +754,6 @@ IPV6_AUTOCONF=no

+  IPV6_DEFAULTGW=2001:DB8::1

+  IPV6_FORCE_ACCEPT_RA=no

+  NETMASK=255.255.252.0

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -884,7 +881,6 @@ NETWORK_CONFIGS = {

+                  BOOTPROTO=none

+                  DEVICE=eth1

+                  HWADDR=cf:d6:af:48:e8:80

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -901,7 +897,6 @@ NETWORK_CONFIGS = {

+                  IPADDR=192.168.21.3

+                  NETMASK=255.255.255.0

+                  METRIC=10000

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -1032,7 +1027,6 @@ NETWORK_CONFIGS = {

+                  IPV6_AUTOCONF=no

+                  IPV6_FORCE_ACCEPT_RA=no

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1095,7 +1089,6 @@ NETWORK_CONFIGS = {

+                  DHCPV6C=yes

+                  IPV6INIT=yes

+                  DEVICE=iface0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1150,7 +1143,6 @@ NETWORK_CONFIGS = {

+                  IPV6INIT=yes

+                  IPV6_FORCE_ACCEPT_RA=yes

+                  DEVICE=iface0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1205,7 +1197,6 @@ NETWORK_CONFIGS = {

+                  IPV6INIT=yes

+                  IPV6_FORCE_ACCEPT_RA=no

+                  DEVICE=iface0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1250,7 +1241,6 @@ NETWORK_CONFIGS = {

+                  IPV6_AUTOCONF=yes

+                  IPV6INIT=yes

+                  DEVICE=iface0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1277,7 +1267,6 @@ NETWORK_CONFIGS = {

+              IPV6_AUTOCONF=no

+              IPV6_FORCE_ACCEPT_RA=no

+              DEVICE=iface0

+ -            NM_CONTROLLED=no

+              ONBOOT=yes

+              TYPE=Ethernet

+              USERCTL=no

+ @@ -1324,7 +1313,6 @@ NETWORK_CONFIGS = {

+              IPV6_AUTOCONF=yes

+              IPV6INIT=yes

+              DEVICE=iface0

+ -            NM_CONTROLLED=no

+              ONBOOT=yes

+              TYPE=Ethernet

+              USERCTL=no

+ @@ -1371,7 +1359,6 @@ NETWORK_CONFIGS = {

+              IPV6INIT=yes

+              IPV6_FORCE_ACCEPT_RA=yes

+              DEVICE=iface0

+ -            NM_CONTROLLED=no

+              ONBOOT=yes

+              TYPE=Ethernet

+              USERCTL=no

+ @@ -1404,7 +1391,6 @@ NETWORK_CONFIGS = {

+              'ifcfg-iface0': textwrap.dedent("""\

+                  BOOTPROTO=dhcp

+                  DEVICE=iface0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1447,7 +1433,6 @@ NETWORK_CONFIGS = {

+                  BOOTPROTO=dhcp

+                  DEVICE=iface0

+                  ETHTOOL_OPTS="wol g"

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -1736,7 +1721,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  DHCPV6C=yes

+                  IPV6INIT=yes

+                  MACADDR=aa:bb:cc:dd:ee:ff

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Bond

+                  USERCTL=no"""),

+ @@ -1744,7 +1728,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  BOOTPROTO=dhcp

+                  DEVICE=bond0.200

+                  DHCLIENT_SET_DEFAULT_ROUTE=no

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PHYSDEV=bond0

+                  USERCTL=no

+ @@ -1762,7 +1745,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  IPV6_DEFAULTGW=2001:4800:78ff:1b::1

+                  MACADDR=bb:bb:bb:bb:bb:aa

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PRIO=22

+                  STP=no

+ @@ -1772,7 +1754,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  BOOTPROTO=none

+                  DEVICE=eth0

+                  HWADDR=c0:d6:9f:2c:e8:80

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -1789,7 +1770,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  MTU=1500

+                  NETMASK=255.255.255.0

+                  NETMASK1=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PHYSDEV=eth0

+                  USERCTL=no

+ @@ -1799,7 +1779,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  DEVICE=eth1

+                  HWADDR=aa:d6:9f:2c:e8:80

+                  MASTER=bond0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  SLAVE=yes

+                  TYPE=Ethernet

+ @@ -1809,7 +1788,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  DEVICE=eth2

+                  HWADDR=c0:bb:9f:2c:e8:80

+                  MASTER=bond0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  SLAVE=yes

+                  TYPE=Ethernet

+ @@ -1819,7 +1797,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  BRIDGE=br0

+                  DEVICE=eth3

+                  HWADDR=66:bb:9f:2c:e8:80

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -1828,7 +1805,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  BRIDGE=br0

+                  DEVICE=eth4

+                  HWADDR=98:bb:9f:2c:e8:80

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -1837,7 +1813,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  DEVICE=eth5

+                  DHCLIENT_SET_DEFAULT_ROUTE=no

+                  HWADDR=98:bb:9f:2c:e8:8a

+ -                NM_CONTROLLED=no

+                  ONBOOT=no

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -1848,7 +1823,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true

+                  IPADDR=192.168.200.7

+                  MTU=9000

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=InfiniBand

+                  USERCTL=no"""),

+ @@ -2293,7 +2267,6 @@ iface bond0 inet6 static

+          MTU=9000

+          NETMASK=255.255.255.0

+          NETMASK1=255.255.255.0

+ -        NM_CONTROLLED=no

+          ONBOOT=yes

+          TYPE=Bond

+          USERCTL=no

+ @@ -2303,7 +2276,6 @@ iface bond0 inet6 static

+          DEVICE=bond0s0

+          HWADDR=aa:bb:cc:dd:e8:00

+          MASTER=bond0

+ -        NM_CONTROLLED=no

+          ONBOOT=yes

+          SLAVE=yes

+          TYPE=Ethernet

+ @@ -2325,7 +2297,6 @@ iface bond0 inet6 static

+          DEVICE=bond0s1

+          HWADDR=aa:bb:cc:dd:e8:01

+          MASTER=bond0

+ -        NM_CONTROLLED=no

+          ONBOOT=yes

+          SLAVE=yes

+          TYPE=Ethernet

+ @@ -2382,7 +2353,6 @@ iface bond0 inet6 static

+                  BOOTPROTO=none

+                  DEVICE=en0

+                  HWADDR=aa:bb:cc:dd:e8:00

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no"""),

+ @@ -2401,7 +2371,6 @@ iface bond0 inet6 static

+                  MTU=2222

+                  NETMASK=255.255.255.0

+                  NETMASK1=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PHYSDEV=en0

+                  USERCTL=no

+ @@ -2466,7 +2435,6 @@ iface bond0 inet6 static

+                  DEVICE=br0

+                  IPADDR=192.168.2.2

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PRIO=22

+                  STP=no

+ @@ -2482,7 +2450,6 @@ iface bond0 inet6 static

+                  IPV6INIT=yes

+                  IPV6_AUTOCONF=no

+                  IPV6_FORCE_ACCEPT_RA=no

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -2496,7 +2463,6 @@ iface bond0 inet6 static

+                  IPV6INIT=yes

+                  IPV6_AUTOCONF=no

+                  IPV6_FORCE_ACCEPT_RA=no

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -2590,7 +2556,6 @@ iface bond0 inet6 static

+                  HWADDR=52:54:00:12:34:00

+                  IPADDR=192.168.1.2

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=no

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -2600,7 +2565,6 @@ iface bond0 inet6 static

+                  DEVICE=eth1

+                  HWADDR=52:54:00:12:34:aa

+                  MTU=1480

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -2609,7 +2573,6 @@ iface bond0 inet6 static

+                  BOOTPROTO=none

+                  DEVICE=eth2

+                  HWADDR=52:54:00:12:34:ff

+ -                NM_CONTROLLED=no

+                  ONBOOT=no

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -3026,7 +2989,6 @@ class TestRhelSysConfigRendering(CiTestCase):

+  BOOTPROTO=dhcp

+  DEVICE=eth1000

+  HWADDR=07-1c-c6-75-a4-be

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -3147,7 +3109,6 @@ GATEWAY=10.0.2.2

+  HWADDR=52:54:00:12:34:00

+  IPADDR=10.0.2.15

+  NETMASK=255.255.255.0

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -3178,7 +3139,6 @@ HWADDR=fa:16:3e:25:b4:59

+  IPADDR=51.68.89.122

+  MTU=1500

+  NETMASK=255.255.240.0

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -3192,7 +3152,6 @@ DEVICE=eth1

+  DHCLIENT_SET_DEFAULT_ROUTE=no

+  HWADDR=fa:16:3e:b1:ca:29

+  MTU=9000

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -3217,7 +3176,6 @@ USERCTL=no

+  #

+  BOOTPROTO=dhcp

+  DEVICE=eth0

+ -NM_CONTROLLED=no

+  ONBOOT=yes

+  TYPE=Ethernet

+  USERCTL=no

+ @@ -3492,7 +3450,6 @@ USERCTL=no

+                     IPV6_FORCE_ACCEPT_RA=no

+                     IPV6_DEFAULTGW=2001:db8::1

+                     NETMASK=255.255.255.0

+ -                   NM_CONTROLLED=no

+                     ONBOOT=yes

+                     TYPE=Ethernet

+                     USERCTL=no

+ @@ -3517,7 +3474,6 @@ USERCTL=no

+              'ifcfg-eno1': textwrap.dedent("""\

+                  BOOTPROTO=none

+                  DEVICE=eno1

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ @@ -3528,7 +3484,6 @@ USERCTL=no

+                  IPADDR=192.6.1.9

+                  MTU=1495

+                  NETMASK=255.255.255.0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  PHYSDEV=eno1

+                  USERCTL=no

+ @@ -3558,7 +3513,6 @@ USERCTL=no

+                  IPADDR=10.101.8.65

+                  MTU=1334

+                  NETMASK=255.255.255.192

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Bond

+                  USERCTL=no

+ @@ -3568,7 +3522,6 @@ USERCTL=no

+                  BOOTPROTO=none

+                  DEVICE=enp0s0

+                  MASTER=bond0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  SLAVE=yes

+                  TYPE=Bond

+ @@ -3579,7 +3532,6 @@ USERCTL=no

+                  BOOTPROTO=none

+                  DEVICE=enp0s1

+                  MASTER=bond0

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  SLAVE=yes

+                  TYPE=Bond

+ @@ -3603,7 +3555,6 @@ USERCTL=no

+                  DEVICE=eno1

+                  HWADDR=07-1c-c6-75-a4-be

+                  METRIC=100

+ -                NM_CONTROLLED=no

+                  ONBOOT=yes

+                  TYPE=Ethernet

+                  USERCTL=no

+ -- 

+ 2.27.0

+ 

cloud-init-20.4-no-override-default-network.patch cloud-init-19.4-no-override-default-network.patch
file renamed
+6 -6
@@ -1,7 +1,7 @@ 

- From 674873573abf2b6e10b09d533a58437c35d508f8 Mon Sep 17 00:00:00 2001

+ From 5514d5922cbc92278868bfea587c4207619d81fc Mon Sep 17 00:00:00 2001

  From: Eduardo Otubo <otubo@redhat.com>

- Date: Fri, 21 Feb 2020 11:40:34 +0100

- Subject: [PATCH] Don't override default network configuration

+ Date: Thu, 3 Dec 2020 12:34:01 +0100

+ Subject: [PATCH 3/3] Don't override default network configuration

  

  Signed-off-by: Eduardo Otubo <otubo@redhat.com>

  ---
@@ -9,10 +9,10 @@ 

   1 file changed, 11 insertions(+), 1 deletion(-)

  

  diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py

- index 310cdf01..87b8f743 100644

+ index 9c822c3e..a240f65e 100644

  --- a/cloudinit/net/sysconfig.py

  +++ b/cloudinit/net/sysconfig.py

- @@ -755,7 +755,17 @@ class Renderer(renderer.Renderer):

+ @@ -918,7 +918,17 @@ class Renderer(renderer.Renderer):

           # Distros configuring /etc/sysconfig/network as a file e.g. Centos

           if sysconfig_path.endswith('network'):

               util.ensure_dir(os.path.dirname(sysconfig_path))
@@ -32,5 +32,5 @@ 

                   netcfg.append('NETWORKING_IPV6=yes')

                   netcfg.append('IPV6_AUTOCONF=no')

  -- 

- 2.17.2

+ 2.27.0

  

@@ -0,0 +1,46 @@ 

+ From f16b18607444cb41e263edfa7fb0c97ba1f7e518 Mon Sep 17 00:00:00 2001

+ From: Eduardo Otubo <otubo@redhat.com>

+ Date: Fri, 4 Dec 2020 11:05:08 +0100

+ Subject: [PATCH] Sandbox ca_certs tests to avoid failure

+ 

+ Signed-off-by: Eduardo Otubo <otubo@redhat.com>

+ ---

+  .../unittests/test_handler/test_handler_ca_certs.py  | 12 ++++--------

+  1 file changed, 4 insertions(+), 8 deletions(-)

+ 

+ diff --git a/tests/unittests/test_handler/test_handler_ca_certs.py b/tests/unittests/test_handler/test_handler_ca_certs.py

+ index e74a0a08..a16430d5 100644

+ --- a/tests/unittests/test_handler/test_handler_ca_certs.py

+ +++ b/tests/unittests/test_handler/test_handler_ca_certs.py

+ @@ -152,6 +152,7 @@ class TestAddCaCerts(TestCase):

+          self.paths = helpers.Paths({

+              'cloud_dir': tmpdir,

+          })

+ +        self.add_patch("cloudinit.config.cc_ca_certs.os.stat", "m_stat")

+  

+      def test_no_certs_in_list(self):

+          """Test that no certificate are written if not provided."""

+ @@ -215,17 +216,12 @@ class TestAddCaCerts(TestCase):

+  

+          expected = "cloud-init-ca-certs.crt\n"

+  

+ -        with ExitStack() as mocks:

+ -            mock_write = mocks.enter_context(

+ -                mock.patch.object(util, 'write_file', autospec=True))

+ -            mock_stat = mocks.enter_context(

+ -                mock.patch("cloudinit.config.cc_ca_certs.os.stat")

+ -            )

+ -            mock_stat.return_value.st_size = 0

+ +        with mock.patch.object(util, 'write_file', autospec=True) as m_write:

+ +            self.m_stat.return_value.st_size = 0

+  

+              cc_ca_certs.add_ca_certs([cert])

+  

+ -            mock_write.assert_has_calls([

+ +            m_write.assert_has_calls([

+                  mock.call("/usr/share/ca-certificates/cloud-init-ca-certs.crt",

+                            cert, mode=0o644),

+                  mock.call("/etc/ca-certificates.conf", expected, omode="wb")])

+ -- 

+ 2.27.0

+ 

file modified
+24 -16
@@ -1,6 +1,6 @@ 

  Name:           cloud-init

- Version:        19.4

- Release:        7%{?dist}

+ Version:        20.4

+ Release:        1%{?dist}

  Summary:        Cloud instance init scripts

  License:        ASL 2.0 or GPLv3

  URL:            http://launchpad.net/cloud-init
@@ -9,24 +9,21 @@ 

  Source1:        cloud-init-tmpfiles.conf

  

  # Disable tests that require pylxd, which we don't have on Fedora

- Patch1:         cloud-init-19.4-disable-lxd-tests.patch

+ Patch1:         cloud-init-20.4-disable-lxd-tests.patch

  

  # Do not write NM_CONTROLLED=no in generated interface config files

  # https://bugzilla.redhat.com/show_bug.cgi?id=1385172

- Patch2:         cloud-init-19.4-nm-controlled.patch

+ Patch2:         cloud-init-20.4-nm-controlled.patch

  

  # Keep old properties in /etc/sysconfig/network

  # https://bugzilla.redhat.com/show_bug.cgi?id=1558641

- Patch3:         cloud-init-19.4-no-override-default-network.patch

+ Patch3:         cloud-init-20.4-no-override-default-network.patch

  

- # Backport for CVE-2020-8631 and CVE-2020-8632

- # https://bugzilla.redhat.com/show_bug.cgi?id=1798729

- # https://bugzilla.redhat.com/show_bug.cgi?id=1798732

- Patch4:         cloud-init-19.4-cc_set_password-increase-random-pwlength-from-9-to-2.patch

- Patch5:         cloud-init-19.4-utils-use-SystemRandom-when-generating-random-passwo.patch

- 

- # https://bugzilla.redhat.com/show_bug.cgi?id=1869757

- Patch6:         cloud-init-19.4-Scaleway-Fix-DatasourceScaleway-to-avoid-backtrace-1.patch

+ # ca_cert tests are failing because Fedora doesn't include those files

+ # by default. This will be upstream soon and we can drop this patch, or

+ # replace by its backport. For now I'll leave this here so the koji ci don't

+ # fail

+ Patch4:         cloud-init-20.4-sandbox-ca_certs-tests-to-avoid-failure.patch

  

  BuildArch:      noarch

  
@@ -36,6 +33,7 @@ 

  BuildRequires:  systemd

  

  # For tests

+ BuildRequires:  python3-pytest

  BuildRequires:  iproute

  BuildRequires:  passwd

  BuildRequires:  python3-configobj
@@ -48,6 +46,7 @@ 

  BuildRequires:  python3-jsonschema

  BuildRequires:  python3-mock

  BuildRequires:  python3-nose

+ BuildRequires:  python3-tox

  BuildRequires:  python3-oauthlib

  BuildRequires:  python3-prettytable

  BuildRequires:  python3-pyserial
@@ -60,7 +59,7 @@ 

  

  Requires:       e2fsprogs

  Requires:       iproute

- Requires:       libselinux-python3

+ Requires:       python3-libselinux

  Requires:       net-tools

  Requires:       policycoreutils-python3

  Requires:       procps
@@ -96,6 +95,9 @@ 

  sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/env python3|' \

         -e 's|#!/usr/bin/python|#!/usr/bin/python3|' tools/* cloudinit/ssh_util.py

  

+ # Removing shebang manually because of rpmlint, will update upstream later

+ sed -i -e 's|#!/usr/bin/python||' cloudinit/cmd/main.py

+ 

  # Use unittest from the standard library. unittest2 is old and being

  # retired in Fedora. See https://bugzilla.redhat.com/show_bug.cgi?id=1794222

  find cloudinit/tests/ tests/ -type f | xargs sed -i s/unittest2/unittest/
@@ -108,7 +110,11 @@ 

  %install

  %py3_install -- --init-system=systemd

  

+ %if 0%{?fedora}

  python3 tools/render-cloudcfg --variant fedora > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg

+ %elif 0%{?rhel}

Should we wait til the next set of patches to add any conditionals for if 0%{?rhel} ?

otubo commented 3 years ago

The intention to add this conditional here is to provide a build to pass the smoke tests for RHEL-9 which are blocked at the moment. The whole purpose of this (kinda) rushed rebase is that, actually. So yes, I agree the best logical moment to add those is all at once later, but for now I'm adding just the RHEL config file in order to unblock the test :)

+ cp -p rhel/cloud.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg

+ %endif

  

  mkdir -p $RPM_BUILD_ROOT/var/lib/cloud

  
@@ -122,8 +128,7 @@ 

  

  

  %check

- nosetests-%{python3_version} tests/unittests/

- 

+ python3 -m pytest tests/unittests

  

  %post

  %systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
@@ -170,6 +175,9 @@ 

  

  

  %changelog

+ * Thu Dec 03 2020 Eduardo Otubo <otubo@redhat.com> - 20.4-2

+ - Updated to 20.4 [bz#1902250]

+ 

  * Mon Sep 07 2020 Eduardo Otubo <otubo@redhat.com> - 19.4-7

  - Fix execution fail with backtrace

  

file added
+69
@@ -0,0 +1,69 @@ 

+ users:

+  - default

+ 

+ disable_root: 1

+ ssh_pwauth:   0

+ 

+ mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']

+ resize_rootfs_tmp: /dev

+ ssh_deletekeys:   1

+ ssh_genkeytypes:  ~

+ syslog_fix_perms: ~

+ disable_vmware_customization: false

+ 

+ cloud_init_modules:

+  - disk_setup

+  - migrator

+  - bootcmd

+  - write-files

+  - growpart

+  - resizefs

+  - set_hostname

+  - update_hostname

+  - update_etc_hosts

+  - rsyslog

+  - users-groups

+  - ssh

+ 

+ cloud_config_modules:

+  - mounts

+  - locale

+  - set-passwords

+  - rh_subscription

+  - yum-add-repo

+  - package-update-upgrade-install

+  - timezone

+  - puppet

+  - chef

+  - salt-minion

+  - mcollective

+  - disable-ec2-metadata

+  - runcmd

+ 

+ cloud_final_modules:

+  - rightscale_userdata

+  - scripts-per-once

+  - scripts-per-boot

+  - scripts-per-instance

+  - scripts-user

+  - ssh-authkey-fingerprints

+  - keys-to-console

+  - phone-home

+  - final-message

+  - power-state-change

+ 

+ system_info:

+   default_user:

+     name: cloud-user

+     lock_passwd: true

+     gecos: Cloud User

+     groups: [adm, systemd-journal]

+     sudo: ["ALL=(ALL) NOPASSWD:ALL"]

+     shell: /bin/bash

+   distro: rhel

+   paths:

+     cloud_dir: /var/lib/cloud

+     templates_dir: /etc/cloud/templates

+   ssh_svcname: sshd

+ 

+ # vim:syntax=yaml

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (cloud-init-19.4.tar.gz) = e69ea47eab41d69d64fa44102fbde59319da5f71a68f28a0f6ac65cd6866542b4fe58a71b84c903cfa9b1d2f26eb648cdf4de633b8df61e4f89c9fa4c2a2b1d3

+ SHA512 (cloud-init-20.4.tar.gz) = da2fa4673b253468380c4472795fd449809c8ac84d8f13ec1472b9b7e7d54e187ae06e5a81a36774793b05f4e1212dca57bc19aa8955b4c7fa7183cb100bfbb9

Update to 20.4

Signed-off-by: Eduardo Otubo otubo@redhat.com

Build failed.

rebased onto 1db165e0316c448583a3d817a69e79a659cf331c

3 years ago

Build failed.

rebased onto 4a04423

3 years ago

Build succeeded.

Should we wait til the next set of patches to add any conditionals for if 0%{?rhel} ?

In the other set of patches there was some work to include the man pages.. Should we add that in here?

The intention to add this conditional here is to provide a build to pass the smoke tests for RHEL-9 which are blocked at the moment. The whole purpose of this (kinda) rushed rebase is that, actually. So yes, I agree the best logical moment to add those is all at once later, but for now I'm adding just the RHEL config file in order to unblock the test :)

In the other set of patches there was some work to include the man pages.. Should we add that in here?

This rebase just updates the previous version and adds cloud.cfg for RHEL. We can start adding missing things in the next steps

Pull-Request has been merged by otubo

3 years ago