Skip to content

Commit

Permalink
app-emulation/wa-linux-agent: Update to 2.9.1.1
Browse files Browse the repository at this point in the history
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
Azure/WALinuxAgent#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 <[email protected]>
  • Loading branch information
jepio committed Nov 15, 2023
1 parent 4bc44d7 commit 0fa4b7f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
From dd1512513b407e23155f58400cacecac8576d6f9 Mon Sep 17 00:00:00 2001
From 7bf2a8a0b0e680b3f2177cfdb3dd4d3807b7d903 Mon Sep 17 00:00:00 2001
From: Krzesimir Nowak <[email protected]>
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
create mode 100644 init/flatcar/10-waagent-sysext.conf
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

Expand All @@ -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"

Expand Down Expand Up @@ -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
+#
Expand Down Expand Up @@ -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"):
Expand All @@ -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 @@
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 0fa4b7f

Please sign in to comment.