SHA256
1
0
forked from pool/cloud-init

Accepting request 860463 from Cloud:Tools

- Update cloud-init-write-routes.patch (bsc#1180176)
  + Follow up to previous changes. Fix order of operations
    error to make gateway comparison between subnet configuration and
    route configuration valuable rather than self-comparing.

- Add cloud-init-sle12-compat.patch (jsc#PM-2335)
  - Python 3.4 compatibility in setup.py
  - Disable some test for mock version compatibility

OBS-URL: https://build.opensuse.org/request/show/860463
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=77
This commit is contained in:
Dominique Leuenberger 2021-01-06 18:56:11 +00:00 committed by Git OBS Bridge
commit fd0b3499be
4 changed files with 161 additions and 8 deletions

View File

@ -0,0 +1,134 @@
--- setup.py.orig
+++ setup.py
@@ -101,10 +101,10 @@ def render_tmpl(template, mode=None):
bname = os.path.basename(template).rstrip(tmpl_ext)
fpath = os.path.join(tmpd, bname)
if VARIANT:
- subprocess.run([sys.executable, './tools/render-cloudcfg', '--variant',
+ subprocess.call([sys.executable, './tools/render-cloudcfg', '--variant',
VARIANT, template, fpath])
else:
- subprocess.run(
+ subprocess.call(
[sys.executable, './tools/render-cloudcfg', template, fpath])
if mode:
os.chmod(fpath, mode)
--- tests/unittests/test_datasource/test_altcloud.py.orig
+++ tests/unittests/test_datasource/test_altcloud.py
@@ -276,43 +276,43 @@ class TestUserDataRhevm(CiTestCase):
'cloudinit.sources.DataSourceAltCloud.util.mount_cb',
'm_mount_cb')
- def test_mount_cb_fails(self):
- '''Test user_data_rhevm() where mount_cb fails.'''
-
- self.m_mount_cb.side_effect = util.MountFailedError("Failed Mount")
- dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
- self.assertEqual(False, dsrc.user_data_rhevm())
-
- def test_modprobe_fails(self):
- '''Test user_data_rhevm() where modprobe fails.'''
-
- self.m_modprobe_floppy.side_effect = util.ProcessExecutionError(
- "Failed modprobe")
- dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
- self.assertEqual(False, dsrc.user_data_rhevm())
-
- def test_no_modprobe_cmd(self):
- '''Test user_data_rhevm() with no modprobe command.'''
-
- self.m_modprobe_floppy.side_effect = util.ProcessExecutionError(
- "No such file or dir")
- dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
- self.assertEqual(False, dsrc.user_data_rhevm())
-
- def test_udevadm_fails(self):
- '''Test user_data_rhevm() where udevadm fails.'''
-
- self.m_udevadm_settle.side_effect = util.ProcessExecutionError(
- "Failed settle.")
- dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
- self.assertEqual(False, dsrc.user_data_rhevm())
-
- def test_no_udevadm_cmd(self):
- '''Test user_data_rhevm() with no udevadm command.'''
-
- self.m_udevadm_settle.side_effect = OSError("No such file or dir")
- dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
- self.assertEqual(False, dsrc.user_data_rhevm())
+# def test_mount_cb_fails(self):
+# '''Test user_data_rhevm() where mount_cb fails.'''
+#
+# self.m_mount_cb.side_effect = util.MountFailedError("Failed Mount")
+# dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
+# self.assertEqual(False, dsrc.user_data_rhevm())
+
+# def test_modprobe_fails(self):
+# '''Test user_data_rhevm() where modprobe fails.'''
+#
+# self.m_modprobe_floppy.side_effect = util.ProcessExecutionError(
+# "Failed modprobe")
+# dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
+# self.assertEqual(False, dsrc.user_data_rhevm())
+
+# def test_no_modprobe_cmd(self):
+# '''Test user_data_rhevm() with no modprobe command.'''
+#
+# self.m_modprobe_floppy.side_effect = util.ProcessExecutionError(
+# "No such file or dir")
+# dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
+# self.assertEqual(False, dsrc.user_data_rhevm())
+
+# def test_udevadm_fails(self):
+# '''Test user_data_rhevm() where udevadm fails.'''
+#
+# self.m_udevadm_settle.side_effect = util.ProcessExecutionError(
+# "Failed settle.")
+# dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
+# self.assertEqual(False, dsrc.user_data_rhevm())
+
+# def test_no_udevadm_cmd(self):
+# '''Test user_data_rhevm() with no udevadm command.'''
+#
+# self.m_udevadm_settle.side_effect = OSError("No such file or dir")
+# dsrc = dsac.DataSourceAltCloud({}, None, self.paths)
+# self.assertEqual(False, dsrc.user_data_rhevm())
class TestUserDataVsphere(CiTestCase):
--- cloudinit/sources/tests/test_oracle.py.orig
+++ cloudinit/sources/tests/test_oracle.py
@@ -484,12 +484,12 @@ class TestNetworkConfigFromOpcImds(test_
self.add_patch(DS_PATH + '.get_interfaces_by_mac',
'm_get_interfaces_by_mac')
- def test_failure_to_readurl(self):
- # readurl failures should just bubble out to the caller
- self.m_readurl.side_effect = Exception('oh no')
- with self.assertRaises(Exception) as excinfo:
- oracle._add_network_config_from_opc_imds({})
- self.assertEqual(str(excinfo.exception), 'oh no')
+# def test_failure_to_readurl(self):
+# # readurl failures should just bubble out to the caller
+# self.m_readurl.side_effect = Exception('oh no')
+# with self.assertRaises(Exception) as excinfo:
+# oracle._add_network_config_from_opc_imds({})
+# self.assertEqual(str(excinfo.exception), 'oh no')
def test_empty_response(self):
# empty response error should just bubble out to the caller
--- cloudinit/tests/test_conftest.py.orig
+++ cloudinit/tests/test_conftest.py
@@ -5,9 +5,9 @@ from cloudinit import util
class TestDisableSubpUsage:
- def test_using_subp_raises_assertion_error(self):
- with pytest.raises(AssertionError):
- util.subp(["some", "args"])
+# def test_using_subp_raises_assertion_error(self):
+# with pytest.raises(AssertionError):
+# util.subp(["some", "args"])
def test_typeerrors_on_incorrect_usage(self):
with pytest.raises(TypeError):

View File

@ -51,6 +51,8 @@ Index: cloudinit/distros/opensuse.py
+ dest = route.get('destination') or route.get('network')
+ if not dest or dest in default_nets:
+ dest = 'default'
+ if not has_default_route:
+ has_default_route = True
+ if dest != 'default':
+ netmask = route.get('netmask')
+ if netmask:
@ -61,6 +63,12 @@ Index: cloudinit/distros/opensuse.py
+ 'Skipping route; has no prefix "%s"', dest
+ )
+ continue
+ gateway = route.get('gateway')
+ if not gateway:
+ LOG.warning(
+ 'Missing gateway for "%s", skipping', dest
+ )
+ continue
+ if (
+ dest == 'default' and
+ has_default_route and
@ -74,14 +82,6 @@ Index: cloudinit/distros/opensuse.py
+ if_name, dest_info
+ )
+ continue
+ if dest == 'default' and not has_default_route:
+ has_default_route = True
+ gateway = route.get('gateway')
+ if not gateway:
+ LOG.warning(
+ 'Missing gateway for "%s", skipping', dest
+ )
+ continue
+ config_routes += ' '.join(
+ [dest, gateway, '-', '-\n']
+ )

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Mon Jan 4 22:27:22 UTC 2021 - Robert Schweikert <rjschwei@suse.com>
- Update cloud-init-write-routes.patch (bsc#1180176)
+ Follow up to previous changes. Fix order of operations
error to make gateway comparison between subnet configuration and
route configuration valuable rather than self-comparing.
-------------------------------------------------------------------
Mon Jan 4 19:52:33 UTC 2021 - Robert Schweikert <rjschwei@suse.com>
- Add cloud-init-sle12-compat.patch (jsc#PM-2335)
- Python 3.4 compatibility in setup.py
- Disable some test for mock version compatibility
-------------------------------------------------------------------
Tue Nov 24 21:14:56 UTC 2020 - Robert Schweikert <rjschwei@suse.com>

View File

@ -40,6 +40,7 @@ Patch58: cloud-init-after-kvp.diff
Patch59: cloud-init-recognize-hpc.patch
# FIXME https://github.com/canonical/cloud-init/commit/eea754492f074e00b601cf77aa278e3623857c5a
Patch60: cloud-init-azure-def-usr-pass.patch
Patch61: cloud-init-sle12-compat.patch
BuildRequires: fdupes
BuildRequires: filesystem
# pkg-config is needed to find correct systemd unit dir
@ -138,6 +139,9 @@ Documentation and examples for cloud-init tools
%patch58 -p1
%patch59
%patch60
%if 0%{?suse_version} < 1500
%patch61
%endif
# patch in the full version to version.py
version_pys=$(find . -name version.py -type f)
[ -n "$version_pys" ] ||