From 0fa4b7f0e92b12a07214903678882816488d64d5 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Wed, 15 Nov 2023 14:14:19 +0100 Subject: [PATCH] app-emulation/wa-linux-agent: Update to 2.9.1.1 This is the current version being deployed to the Azure fleet for other distros. This update contains a fix for: Failed to get the PID of the DHCP client: invalid literal for int() with base 10: 'MainPID=1640' The upstream fix (stripping MainPid=) is in https://github.com/Azure/WALinuxAgent/pull/2784. The patch has also been updated to fix the error: Unable to setup the persistent firewall rules: [Errno 30] Read-only file system: '/lib/systemd/system/waagent-network-setup.service' by redirecting unit file installation to /etc/systemd/system. Signed-off-by: Jeremi Piotrowski --- .../files/0001-flatcar-changes.patch | 47 ++++++++++--------- ...build => wa-linux-agent-2.9.1.1-r1.ebuild} | 0 ...-r3.ebuild => oem-azure-2.9.1.1-r1.ebuild} | 0 3 files changed, 25 insertions(+), 22 deletions(-) rename sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/{wa-linux-agent-2.6.0.2-r4.ebuild => wa-linux-agent-2.9.1.1-r1.ebuild} (100%) rename sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/{oem-azure-2.6.0.2-r3.ebuild => oem-azure-2.9.1.1-r1.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch index 917c71629a7..9688259f898 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch @@ -1,18 +1,18 @@ -From dd1512513b407e23155f58400cacecac8576d6f9 Mon Sep 17 00:00:00 2001 +From 7bf2a8a0b0e680b3f2177cfdb3dd4d3807b7d903 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 27 Feb 2023 15:59:21 +0100 Subject: [PATCH] flatcar changes --- - azurelinuxagent/common/osutil/coreos.py | 39 +----- - azurelinuxagent/common/osutil/coreoscommon.py | 57 ++++++++ + azurelinuxagent/common/osutil/coreos.py | 40 +----- + azurelinuxagent/common/osutil/coreoscommon.py | 59 +++++++++ azurelinuxagent/common/osutil/factory.py | 3 + azurelinuxagent/common/osutil/flatcar.py | 60 +++++++++ config/flatcar/waagent.conf | 122 ++++++++++++++++++ init/flatcar/10-waagent-sysext.conf | 2 + init/flatcar/waagent.service | 30 +++++ setup.py | 20 ++- - 8 files changed, 291 insertions(+), 42 deletions(-) + 8 files changed, 293 insertions(+), 43 deletions(-) create mode 100644 azurelinuxagent/common/osutil/coreoscommon.py create mode 100644 azurelinuxagent/common/osutil/flatcar.py create mode 100644 config/flatcar/waagent.conf @@ -20,14 +20,13 @@ Subject: [PATCH] flatcar changes create mode 100644 init/flatcar/waagent.service diff --git a/azurelinuxagent/common/osutil/coreos.py b/azurelinuxagent/common/osutil/coreos.py -index fc0a6604..314008f0 100644 +index 373727e2..63578932 100644 --- a/azurelinuxagent/common/osutil/coreos.py +++ b/azurelinuxagent/common/osutil/coreos.py -@@ -17,11 +17,10 @@ - # +@@ -18,10 +18,10 @@ import os --import azurelinuxagent.common.utils.shellutil as shellutil + from azurelinuxagent.common.utils import shellutil -from azurelinuxagent.common.osutil.default import DefaultOSUtil +from azurelinuxagent.common.osutil.coreoscommon import CoreosCommonUtil @@ -37,7 +36,7 @@ index fc0a6604..314008f0 100644 def __init__(self): super(CoreOSUtil, self).__init__() -@@ -46,40 +45,6 @@ class CoreOSUtil(DefaultOSUtil): +@@ -46,42 +46,6 @@ class CoreOSUtil(DefaultOSUtil): def get_agent_bin_path(): return "/usr/share/oem/bin" @@ -73,17 +72,19 @@ index fc0a6604..314008f0 100644 - return shellutil.run("systemctl stop {0}".format(self.service_name), chk_err=False) - - def get_dhcp_pid(self): -- return self._get_dhcp_pid(["systemctl", "show", "-p", "MainPID", "systemd-networkd"]) +- return self._get_dhcp_pid( +- ["systemctl", "show", "-p", "MainPID", "systemd-networkd"], +- transform_command_output=lambda o: o.replace("MainPID=", "")) - def conf_sshd(self, disable_password): # In CoreOS, /etc/sshd_config is mount readonly. Skip the setting. pass diff --git a/azurelinuxagent/common/osutil/coreoscommon.py b/azurelinuxagent/common/osutil/coreoscommon.py new file mode 100644 -index 00000000..fde9a456 +index 00000000..66eae16e --- /dev/null +++ b/azurelinuxagent/common/osutil/coreoscommon.py -@@ -0,0 +1,57 @@ +@@ -0,0 +1,59 @@ +# +# Copyright 2023 Microsoft Corporation +# @@ -140,20 +141,22 @@ index 00000000..fde9a456 + return shellutil.run("systemctl stop {0}".format(self.service_name), chk_err=False) + + def get_dhcp_pid(self): -+ return self._get_dhcp_pid(["systemctl", "show", "-p", "MainPID", "systemd-networkd"]) ++ return self._get_dhcp_pid( ++ ["systemctl", "show", "-p", "MainPID", "systemd-networkd"], ++ transform_command_output=lambda o: o.replace("MainPID=", "")) diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py -index b5ee0b09..9280c645 100644 +index 83123e3f..b9257a9b 100644 --- a/azurelinuxagent/common/osutil/factory.py +++ b/azurelinuxagent/common/osutil/factory.py -@@ -27,6 +27,7 @@ from .clearlinux import ClearLinuxUtil - from .coreos import CoreOSUtil +@@ -28,6 +28,7 @@ from .coreos import CoreOSUtil from .debian import DebianOSBaseUtil, DebianOSModernUtil from .default import DefaultOSUtil + from .devuan import DevuanOSUtil +from .flatcar import FlatcarUtil from .freebsd import FreeBSDOSUtil from .gaia import GaiaOSUtil from .iosxe import IosxeOSUtil -@@ -82,6 +83,8 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) +@@ -88,6 +89,8 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) return DebianOSBaseUtil() if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"): @@ -164,7 +167,7 @@ index b5ee0b09..9280c645 100644 if distro_name in ("suse", "sle_hpc", "sles", "opensuse"): diff --git a/azurelinuxagent/common/osutil/flatcar.py b/azurelinuxagent/common/osutil/flatcar.py new file mode 100644 -index 00000000..bf739a8e +index 00000000..bfb77df1 --- /dev/null +++ b/azurelinuxagent/common/osutil/flatcar.py @@ -0,0 +1,60 @@ @@ -201,7 +204,7 @@ index 00000000..bf739a8e + + @staticmethod + def get_systemd_unit_file_install_path(): -+ return "/usr/lib/systemd/system" ++ return "/etc/systemd/system" + + def conf_sshd(self, disable_password): + ssh_dir = conf.get_ssh_dir() @@ -401,10 +404,10 @@ index 00000000..d0d6f7c8 +[Install] +WantedBy=multi-user.target diff --git a/setup.py b/setup.py -index d38d74d6..57b0edb9 100755 +index 8f5d92b4..35400e09 100755 --- a/setup.py +++ b/setup.py -@@ -125,12 +125,22 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912 +@@ -135,12 +135,22 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912 src=["init/arch/waagent.service"]) elif name in ('coreos', 'flatcar'): set_bin_files(data_files, dest=agent_bin_path) @@ -433,5 +436,5 @@ index d38d74d6..57b0edb9 100755 set_bin_files(data_files, dest=agent_bin_path) set_conf_files(data_files, dest="/usr/share/defaults/waagent", -- -2.25.1 +2.39.2 diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.6.0.2-r4.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.9.1.1-r1.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.6.0.2-r4.ebuild rename to sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/wa-linux-agent-2.9.1.1-r1.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r3.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r1.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.6.0.2-r3.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/oem-azure-2.9.1.1-r1.ebuild