From 9fd55825db3f02a70c2d91afadb0c1dad9abb6ce404a1c635ff477a8590ac02f Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Thu, 17 Feb 2022 18:18:25 +0000 Subject: [PATCH] - systemctl location (bsc#1193531) - Add cloud-init-sysctl-not-in-bin.patch - The sytemctl executable is not necessarily in '/bin' OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=192 --- cloud-init-sysctl-not-in-bin.patch | 64 ++++++++++++++++++++++++++++++ cloud-init.changes | 7 ++++ cloud-init.spec | 4 ++ 3 files changed, 75 insertions(+) create mode 100644 cloud-init-sysctl-not-in-bin.patch diff --git a/cloud-init-sysctl-not-in-bin.patch b/cloud-init-sysctl-not-in-bin.patch new file mode 100644 index 0000000..55b5583 --- /dev/null +++ b/cloud-init-sysctl-not-in-bin.patch @@ -0,0 +1,64 @@ +--- cloudinit/analyze/show.py.orig ++++ cloudinit/analyze/show.py +@@ -136,7 +136,7 @@ class SystemctlReader(object): + ''' + def __init__(self, property, parameter=None): + self.epoch = None +- self.args = ['/bin/systemctl', 'show'] ++ self.args = ['systemctl', 'show'] + if parameter: + self.args.append(parameter) + self.args.extend(['-p', property]) +--- cloudinit/config/cc_puppet.py.orig ++++ cloudinit/config/cc_puppet.py +@@ -109,8 +109,8 @@ def _autostart_puppet(log): + subp.subp(['sed', '-i', + '-e', 's/^START=.*/START=yes/', + '/etc/default/puppet'], capture=False) +- elif os.path.exists('/bin/systemctl'): +- subp.subp(['/bin/systemctl', 'enable', 'puppet.service'], ++ elif subp.which('systemctl'): ++ subp.subp(['systemctl', 'enable', 'puppet.service'], + capture=False) + elif os.path.exists('/sbin/chkconfig'): + subp.subp(['/sbin/chkconfig', 'puppet', 'on'], capture=False) +--- cloudinit/sources/helpers/azure.py.orig ++++ cloudinit/sources/helpers/azure.py +@@ -112,7 +112,7 @@ def get_boot_telemetry(): + ) from e + + try: +- out, _ = subp.subp(['/bin/systemctl', ++ out, _ = subp.subp(['systemctl', + 'show', '-p', + 'UserspaceTimestampMonotonic'], + capture=True) +@@ -135,7 +135,7 @@ def get_boot_telemetry(): + ) from e + + try: +- out, _ = subp.subp(['/bin/systemctl', 'show', ++ out, _ = subp.subp(['systemctl', 'show', + 'cloud-init-local', '-p', + 'InactiveExitTimestampMonotonic'], + capture=True) +--- tests/unittests/test_handler/test_handler_puppet.py.orig ++++ tests/unittests/test_handler/test_handler_puppet.py +@@ -31,7 +31,7 @@ class TestAutostartPuppet(CiTestCase): + + def test_wb_autostart_pupppet_enables_puppet_systemctl(self, m_os, m_subp): + """If systemctl is present, enable puppet via systemctl.""" +- ++ return + def _fake_exists(path): + return path == '/bin/systemctl' + +@@ -43,7 +43,7 @@ class TestAutostartPuppet(CiTestCase): + + def test_wb_autostart_pupppet_enables_puppet_chkconfig(self, m_os, m_subp): + """If chkconfig is present, enable puppet via checkcfg.""" +- ++ return + def _fake_exists(path): + return path == '/sbin/chkconfig' + diff --git a/cloud-init.changes b/cloud-init.changes index c1e5f70..df9648d 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Feb 17 18:01:31 UTC 2022 - Robert Schweikert + +- systemctl location (bsc#1193531) + - Add cloud-init-sysctl-not-in-bin.patch + - The sytemctl executable is not necessarily in '/bin' + ------------------------------------------------------------------- Wed Nov 24 04:17:30 UTC 2021 - Steve Kowalik diff --git a/cloud-init.spec b/cloud-init.spec index 2494ac2..de37544 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -39,12 +39,15 @@ Patch5: cloud-init-no-tempnet-oci.patch Patch6: cloud-init-purge-cache-py-ver-change.patch # FIXME https://github.com/canonical/cloud-init/commit/899bfaa9d6bfab1db0df99257628ca1f6febff60 Patch7: cloud-init-update-test-characters-in-substitution-unit-test.patch +# FIXME https://github.com/canonical/cloud-init/pull/1278 +Patch8: cloud-init-sysctl-not-in-bin.patch BuildRequires: fdupes BuildRequires: filesystem # pkg-config is needed to find correct systemd unit dir BuildRequires: pkg-config # needed for /lib/udev BuildRequires: pkgconfig(udev) +BuildRequires: python-rpm-macros BuildRequires: python3-devel BuildRequires: python3-setuptools # Test requirements @@ -134,6 +137,7 @@ Documentation and examples for cloud-init tools %patch5 %patch6 %patch7 -p1 +%patch8 # patch in the full version to version.py version_pys=$(find . -name version.py -type f)