Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cloud-init for openSUSE:Factory checked in at 2024-05-11 18:18:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cloud-init (Old) and /work/SRC/openSUSE:Factory/.cloud-init.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cloud-init" Sat May 11 18:18:44 2024 rev:100 rq:1172791 version:23.3 Changes: -------- --- /work/SRC/openSUSE:Factory/cloud-init/cloud-init.changes 2024-04-17 14:45:23.878105964 +0200 +++ /work/SRC/openSUSE:Factory/.cloud-init.new.1880/cloud-init.changes 2024-05-11 18:18:45.684890675 +0200 @@ -1,0 +2,7 @@ +Mon Apr 29 21:49:48 UTC 2024 - Robert Schweikert <[email protected]> + +- Add cloud-init-usr-sudoers.patch (bsc#1223469) + + Handle the existence of /usr/etc/sudoers to search for the expected + include location + +------------------------------------------------------------------- New: ---- cloud-init-usr-sudoers.patch BETA DEBUG BEGIN: New: - Add cloud-init-usr-sudoers.patch (bsc#1223469) + Handle the existence of /usr/etc/sudoers to search for the expected BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cloud-init.spec ++++++ --- /var/tmp/diff_new_pack.XyxdQ9/_old 2024-05-11 18:18:46.812931752 +0200 +++ /var/tmp/diff_new_pack.XyxdQ9/_new 2024-05-11 18:18:46.816931898 +0200 @@ -49,6 +49,8 @@ Patch12: cloud-init-no-openstack-guess.patch # FIXME upstream comit 812df5038 Patch13: cloud-init-no-nmcfg-needed.patch +# FIXME https://github.com/canonical/cloud-init/pull/5161 +Patch14: cloud-init-usr-sudoers.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir @@ -160,6 +162,7 @@ %patch -P 11 %patch -P 12 %patch -P 13 +%patch -P 14 # patch in the full version to version.py version_pys=$(find . -name version.py -type f) ++++++ cloud-init-usr-sudoers.patch ++++++ --- cloudinit/distros/__init__.py.orig +++ cloudinit/distros/__init__.py @@ -880,9 +880,12 @@ class Distro(persistence.CloudInitPickle # it actually exists as a directory sudoers_contents = "" base_exists = False + system_sudo_base = "/usr/etc/sudoers" if os.path.exists(sudo_base): sudoers_contents = util.load_file(sudo_base) base_exists = True + elif os.path.exists(system_sudo_base): + sudoers_contents = util.load_file(system_sudo_base) found_include = False for line in sudoers_contents.splitlines(): line = line.strip() @@ -907,7 +910,7 @@ class Distro(persistence.CloudInitPickle "#includedir %s" % (path), "", ] - sudoers_contents = "\n".join(lines) + sudoers_contents += "\n".join(lines) util.write_file(sudo_base, sudoers_contents, 0o440) else: lines = [ --- tests/unittests/distros/test__init__.py.orig +++ tests/unittests/distros/test__init__.py @@ -230,6 +230,41 @@ class TestGenericDistro(helpers.Filesyst self.assertIn("josh", contents) self.assertEqual(2, contents.count("josh")) + def test_sudoers_ensure_append_sudoer_file(self): + cls = distros.fetch("ubuntu") + d = cls("ubuntu", {}, None) + self.patchOS(self.tmp) + self.patchUtils(self.tmp) + util.write_file("/etc/sudoers", "josh, josh\n") + d.ensure_sudo_dir("/b", "/etc/sudoers") + contents = util.load_file("/etc/sudoers") + self.assertIn("includedir /b", contents) + self.assertTrue(os.path.isdir("/b")) + self.assertIn("josh", contents) + self.assertEqual(2, contents.count("josh")) + + def test_usr_sudoers_ensure_new(self): + cls = distros.fetch("ubuntu") + d = cls("ubuntu", {}, None) + self.patchOS(self.tmp) + self.patchUtils(self.tmp) + util.write_file("/usr/etc/sudoers", "josh, josh\n") + d.ensure_sudo_dir("/b") + contents = util.load_file("/etc/sudoers") + self.assertIn("josh", contents) + self.assertEqual(2, contents.count("josh")) + self.assertIn("includedir /b", contents) + self.assertTrue(os.path.isdir("/b")) + + def test_usr_sudoers_ensure_no_etc_creat(self): + cls = distros.fetch("ubuntu") + d = cls("ubuntu", {}, None) + self.patchOS(self.tmp) + self.patchUtils(self.tmp) + util.write_file("/usr/etc/sudoers", "#includedir /b") + d.ensure_sudo_dir("/b") + self.assertTrue(not os.path.exists("/etc/sudoers")) + def test_sudoers_ensure_only_one_includedir(self): cls = distros.fetch("ubuntu") d = cls("ubuntu", {}, None)
