Skip to content

Commit c2f0432

Browse files
authored
Merge pull request #1395 from flatcar/update-azure-linux-agent
app-emulation/wa-linux-agent: Update to 2.9.1.1
2 parents 9ffb098 + f5c670e commit c2f0432

File tree

6 files changed

+67
-25
lines changed

6 files changed

+67
-25
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Azure: WALinuxAgent ([v2.9.1.1](https://github.com/Azure/WALinuxAgent/releases/tag/v2.9.1.1))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DIST wa-linux-agent-2.6.0.2.tar.gz 1530936 BLAKE2B f47a4293a939da03859dafac2f422c4066dc2e92d6d4417a7e61e64abf22f1e096fcc7fc4ddfbe3166427ca44df75d967dbd1379d06c1b409fc3edc6340a17f2 SHA512 8826482ceb9e47a9b7f7271c5db19bf46ccabcefd327119e44f2760b147206a1fd3905a0cc8178527fe3326d4179f84bab8f7c673ede3c6de8dcacde0008e405
1+
DIST wa-linux-agent-2.9.1.1.tar.gz 1986486 BLAKE2B ce630830886fe9bb729cfa7d92ac40bf158d26272b83e099fa2957928761642f84af2eef28ad691a076a89af6304f6ae67d7aa37ecf8629b3b973d083e619ae7 SHA512 3f44aecc16ac545db4b550586f168dbbdef34289aad6775973517bf645e5a1d486864c01e974f03a71b3e946c14e1ca140673a75c1cd602aac28725eaa68e83d

sdk_container/src/third_party/coreos-overlay/app-emulation/wa-linux-agent/files/0001-flatcar-changes.patch

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1-
From dd1512513b407e23155f58400cacecac8576d6f9 Mon Sep 17 00:00:00 2001
1+
From 7382c63bb2c90a1173393faf093002341f830a09 Mon Sep 17 00:00:00 2001
22
From: Krzesimir Nowak <knowak@microsoft.com>
33
Date: Mon, 27 Feb 2023 15:59:21 +0100
44
Subject: [PATCH] flatcar changes
55

6+
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
67
---
7-
azurelinuxagent/common/osutil/coreos.py | 39 +-----
8-
azurelinuxagent/common/osutil/coreoscommon.py | 57 ++++++++
8+
azurelinuxagent/common/osutil/coreos.py | 40 +-----
9+
azurelinuxagent/common/osutil/coreoscommon.py | 59 +++++++++
910
azurelinuxagent/common/osutil/factory.py | 3 +
10-
azurelinuxagent/common/osutil/flatcar.py | 60 +++++++++
11+
azurelinuxagent/common/osutil/flatcar.py | 78 +++++++++++
12+
.../common/persist_firewall_rules.py | 1 +
1113
config/flatcar/waagent.conf | 122 ++++++++++++++++++
1214
init/flatcar/10-waagent-sysext.conf | 2 +
1315
init/flatcar/waagent.service | 30 +++++
1416
setup.py | 20 ++-
15-
8 files changed, 291 insertions(+), 42 deletions(-)
17+
9 files changed, 312 insertions(+), 43 deletions(-)
1618
create mode 100644 azurelinuxagent/common/osutil/coreoscommon.py
1719
create mode 100644 azurelinuxagent/common/osutil/flatcar.py
1820
create mode 100644 config/flatcar/waagent.conf
1921
create mode 100644 init/flatcar/10-waagent-sysext.conf
2022
create mode 100644 init/flatcar/waagent.service
2123

2224
diff --git a/azurelinuxagent/common/osutil/coreos.py b/azurelinuxagent/common/osutil/coreos.py
23-
index fc0a6604..314008f0 100644
25+
index 373727e2..63578932 100644
2426
--- a/azurelinuxagent/common/osutil/coreos.py
2527
+++ b/azurelinuxagent/common/osutil/coreos.py
26-
@@ -17,11 +17,10 @@
27-
#
28+
@@ -18,10 +18,10 @@
2829

2930
import os
30-
-import azurelinuxagent.common.utils.shellutil as shellutil
31+
from azurelinuxagent.common.utils import shellutil
3132
-from azurelinuxagent.common.osutil.default import DefaultOSUtil
3233
+from azurelinuxagent.common.osutil.coreoscommon import CoreosCommonUtil
3334

@@ -37,7 +38,7 @@ index fc0a6604..314008f0 100644
3738

3839
def __init__(self):
3940
super(CoreOSUtil, self).__init__()
40-
@@ -46,40 +45,6 @@ class CoreOSUtil(DefaultOSUtil):
41+
@@ -46,42 +46,6 @@ class CoreOSUtil(DefaultOSUtil):
4142
def get_agent_bin_path():
4243
return "/usr/share/oem/bin"
4344

@@ -73,17 +74,19 @@ index fc0a6604..314008f0 100644
7374
- return shellutil.run("systemctl stop {0}".format(self.service_name), chk_err=False)
7475
-
7576
- def get_dhcp_pid(self):
76-
- return self._get_dhcp_pid(["systemctl", "show", "-p", "MainPID", "systemd-networkd"])
77+
- return self._get_dhcp_pid(
78+
- ["systemctl", "show", "-p", "MainPID", "systemd-networkd"],
79+
- transform_command_output=lambda o: o.replace("MainPID=", ""))
7780
-
7881
def conf_sshd(self, disable_password):
7982
# In CoreOS, /etc/sshd_config is mount readonly. Skip the setting.
8083
pass
8184
diff --git a/azurelinuxagent/common/osutil/coreoscommon.py b/azurelinuxagent/common/osutil/coreoscommon.py
8285
new file mode 100644
83-
index 00000000..fde9a456
86+
index 00000000..66eae16e
8487
--- /dev/null
8588
+++ b/azurelinuxagent/common/osutil/coreoscommon.py
86-
@@ -0,0 +1,57 @@
89+
@@ -0,0 +1,59 @@
8790
+#
8891
+# Copyright 2023 Microsoft Corporation
8992
+#
@@ -140,20 +143,22 @@ index 00000000..fde9a456
140143
+ return shellutil.run("systemctl stop {0}".format(self.service_name), chk_err=False)
141144
+
142145
+ def get_dhcp_pid(self):
143-
+ return self._get_dhcp_pid(["systemctl", "show", "-p", "MainPID", "systemd-networkd"])
146+
+ return self._get_dhcp_pid(
147+
+ ["systemctl", "show", "-p", "MainPID", "systemd-networkd"],
148+
+ transform_command_output=lambda o: o.replace("MainPID=", ""))
144149
diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py
145-
index b5ee0b09..9280c645 100644
150+
index 83123e3f..b9257a9b 100644
146151
--- a/azurelinuxagent/common/osutil/factory.py
147152
+++ b/azurelinuxagent/common/osutil/factory.py
148-
@@ -27,6 +27,7 @@ from .clearlinux import ClearLinuxUtil
149-
from .coreos import CoreOSUtil
153+
@@ -28,6 +28,7 @@ from .coreos import CoreOSUtil
150154
from .debian import DebianOSBaseUtil, DebianOSModernUtil
151155
from .default import DefaultOSUtil
156+
from .devuan import DevuanOSUtil
152157
+from .flatcar import FlatcarUtil
153158
from .freebsd import FreeBSDOSUtil
154159
from .gaia import GaiaOSUtil
155160
from .iosxe import IosxeOSUtil
156-
@@ -82,6 +83,8 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
161+
@@ -88,6 +89,8 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
157162
return DebianOSBaseUtil()
158163

159164
if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"):
@@ -164,10 +169,10 @@ index b5ee0b09..9280c645 100644
164169
if distro_name in ("suse", "sle_hpc", "sles", "opensuse"):
165170
diff --git a/azurelinuxagent/common/osutil/flatcar.py b/azurelinuxagent/common/osutil/flatcar.py
166171
new file mode 100644
167-
index 00000000..bf739a8e
172+
index 00000000..e31b2923
168173
--- /dev/null
169174
+++ b/azurelinuxagent/common/osutil/flatcar.py
170-
@@ -0,0 +1,60 @@
175+
@@ -0,0 +1,78 @@
171176
+#
172177
+# Copyright 2023 Microsoft Corporation
173178
+#
@@ -194,14 +199,15 @@ index 00000000..bf739a8e
194199
+import azurelinuxagent.common.conf as conf
195200
+import azurelinuxagent.common.logger as logger
196201
+import azurelinuxagent.common.utils.fileutil as fileutil
202+
+import azurelinuxagent.common.utils.shellutil as shellutil
197203
+
198204
+from azurelinuxagent.common.osutil.coreoscommon import CoreosCommonUtil
199205
+
200206
+class FlatcarUtil(CoreosCommonUtil):
201207
+
202208
+ @staticmethod
203209
+ def get_systemd_unit_file_install_path():
204-
+ return "/usr/lib/systemd/system"
210+
+ return "/etc/systemd/system"
205211
+
206212
+ def conf_sshd(self, disable_password):
207213
+ ssh_dir = conf.get_ssh_dir()
@@ -228,6 +234,35 @@ index 00000000..bf739a8e
228234
+ os.remove(conf_file_path)
229235
+ os.rename(conf_file_path2, conf_file_path)
230236
+ super(CoreosCommonUtil, self).conf_sshd(disable_password)
237+
+
238+
+ def restart_if(self, ifname, retries=3, wait=5):
239+
+ """
240+
+ Restart an interface by bouncing the link. systemd-networkd observes
241+
+ this event, and forces a renew of DHCP.
242+
+ """
243+
+ retry_limit = retries + 1
244+
+ for attempt in range(1, retry_limit):
245+
+ return_code = shellutil.run("ip link set {0} down && ip link set {0} up".format(ifname))
246+
+ if return_code == 0:
247+
+ return
248+
+ logger.warn("failed to restart {0}: return code {1}".format(ifname, return_code))
249+
+ if attempt < retry_limit:
250+
+ logger.info("retrying in {0} seconds".format(wait))
251+
+ time.sleep(wait)
252+
+ else:
253+
+ logger.warn("exceeded restart retries")
254+
diff --git a/azurelinuxagent/common/persist_firewall_rules.py b/azurelinuxagent/common/persist_firewall_rules.py
255+
index 74b878ce..22562c96 100644
256+
--- a/azurelinuxagent/common/persist_firewall_rules.py
257+
+++ b/azurelinuxagent/common/persist_firewall_rules.py
258+
@@ -35,6 +35,7 @@ class PersistFirewallRulesHandler(object):
259+
# Do not edit.
260+
[Unit]
261+
Description=Setup network rules for WALinuxAgent
262+
+After=systemd-sysext.service
263+
Before=network-pre.target
264+
Wants=network-pre.target
265+
DefaultDependencies=no
231266
diff --git a/config/flatcar/waagent.conf b/config/flatcar/waagent.conf
232267
new file mode 100644
233268
index 00000000..b453c634
@@ -401,10 +436,10 @@ index 00000000..d0d6f7c8
401436
+[Install]
402437
+WantedBy=multi-user.target
403438
diff --git a/setup.py b/setup.py
404-
index d38d74d6..57b0edb9 100755
439+
index 8f5d92b4..35400e09 100755
405440
--- a/setup.py
406441
+++ b/setup.py
407-
@@ -125,12 +125,22 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912
442+
@@ -135,12 +135,22 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912
408443
src=["init/arch/waagent.service"])
409444
elif name in ('coreos', 'flatcar'):
410445
set_bin_files(data_files, dest=agent_bin_path)
@@ -433,5 +468,5 @@ index d38d74d6..57b0edb9 100755
433468
set_bin_files(data_files, dest=agent_bin_path)
434469
set_conf_files(data_files, dest="/usr/share/defaults/waagent",
435470
--
436-
2.25.1
471+
2.39.2
437472

sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ to_delete=(
1414
rm -rf "${to_delete[@]/#/${rootfs}}"
1515

1616
ln -sf /usr/bin/true "${rootfs}/usr/bin/eject"
17+
18+
# At runtime we need the agent to write systemd.service to /etc but during
19+
# package creation it needs to be /usr/lib. waagent uses the same function in
20+
# both cases, so mangle manually.
21+
mkdir -p "${rootfs}"/usr/lib/systemd
22+
mv "${rootfs}"/{etc,usr/lib}/systemd/system

0 commit comments

Comments
 (0)