From 60528a445b7b77ab2146ecf9c8c593e1e38fa031 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 09 2022 16:12:35 +0000 Subject: import WALinuxAgent-2.3.0.2-4.el7_9 --- diff --git a/.WALinuxAgent.metadata b/.WALinuxAgent.metadata index 38bd7d7..8ac06c5 100644 --- a/.WALinuxAgent.metadata +++ b/.WALinuxAgent.metadata @@ -1 +1 @@ -6a636c47aea02063bde8282a5bc2bb61d4afe640 SOURCES/WALinuxAgent-2.2.46.tar.gz +de1d5307a1fc937038536b27d1e32f7ee851d0dd SOURCES/WALinuxAgent-2.3.0.2.tar.gz diff --git a/.gitignore b/.gitignore index a773e1c..1b6e24f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/WALinuxAgent-2.2.46.tar.gz +SOURCES/WALinuxAgent-2.3.0.2.tar.gz diff --git a/SOURCES/0001-Add-inital-redhat-build-support.patch b/SOURCES/0001-Add-inital-redhat-build-support.patch new file mode 100644 index 0000000..e011e4c --- /dev/null +++ b/SOURCES/0001-Add-inital-redhat-build-support.patch @@ -0,0 +1,63 @@ +From d26fad1074c012a5f47f4fe6b812c558ca2d1ceb Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Thu, 6 Oct 2016 12:25:35 +0200 +Subject: Add inital redhat build support + +Rebase notes (2.2.26): +- Do not use INSTALED_FILES for %files + +Rebase notes (2.2.10): +- switched to sha256 +- added .gitpublish profile + +Merged patches (2.3.0.2): +- cbf8baa1 Remove FIPS setting from the default config +(cherry picked from commit 19d4f82cd5345fdc52b357afcf3b5aa4bc4ce4d9) +(cherry picked from commit 1676db295321adbd571f04773782eed5b0817d64) +--- + .gitignore | 3 + + config/waagent.conf | 3 - + redhat/.gitignore | 1 + + redhat/Makefile | 72 +++++++ + redhat/Makefile.common | 37 ++++ + redhat/WALinuxAgent.spec.template | 231 ++++++++++++++++++++ + redhat/rpmbuild/BUILD/.gitignore | 2 + + redhat/rpmbuild/RPMS/.gitignore | 2 + + redhat/rpmbuild/SOURCES/.gitignore | 2 + + redhat/rpmbuild/SPECS/.gitignore | 2 + + redhat/rpmbuild/SRPMS/.gitignore | 2 + + redhat/scripts/frh.py | 27 +++ + redhat/scripts/git-backport-diff | 327 +++++++++++++++++++++++++++++ + redhat/scripts/git-compile-check | 215 +++++++++++++++++++ + redhat/scripts/process-patches.sh | 79 +++++++ + redhat/scripts/tarball_checksum.sh | 3 + + 16 files changed, 1005 insertions(+), 3 deletions(-) + create mode 100644 redhat/.gitignore + create mode 100644 redhat/Makefile + create mode 100644 redhat/Makefile.common + create mode 100644 redhat/WALinuxAgent.spec.template + create mode 100644 redhat/rpmbuild/BUILD/.gitignore + create mode 100644 redhat/rpmbuild/RPMS/.gitignore + create mode 100644 redhat/rpmbuild/SOURCES/.gitignore + create mode 100644 redhat/rpmbuild/SPECS/.gitignore + create mode 100644 redhat/rpmbuild/SRPMS/.gitignore + create mode 100755 redhat/scripts/frh.py + create mode 100755 redhat/scripts/git-backport-diff + create mode 100755 redhat/scripts/git-compile-check + create mode 100755 redhat/scripts/process-patches.sh + create mode 100755 redhat/scripts/tarball_checksum.sh + +diff --git a/config/waagent.conf b/config/waagent.conf +index 87e201e9..0575359f 100644 +--- a/config/waagent.conf ++++ b/config/waagent.conf +@@ -78,9 +78,6 @@ Logs.Collect=n + # How frequently to collect logs, default is each hour + Logs.CollectPeriod=3600 + +-# Is FIPS enabled +-OS.EnableFIPS=n +- + # Root device timeout in seconds. + OS.RootDeviceScsiTimeout=300 + diff --git a/SOURCES/0002-Implement-restart_if-for-RedHat-OS.patch b/SOURCES/0002-Implement-restart_if-for-RedHat-OS.patch new file mode 100644 index 0000000..d1ae708 --- /dev/null +++ b/SOURCES/0002-Implement-restart_if-for-RedHat-OS.patch @@ -0,0 +1,40 @@ +From c32d80187c0d504a910ac89d3df26a57b5e182ed Mon Sep 17 00:00:00 2001 +From: Miroslav Rezanina +Date: Tue, 24 May 2022 04:10:46 -0400 +Subject: Implement restart_if for RedHat OS + +Signed-off-by: Vitaly Kuznetsov +Signed-off-by: Miroslav Rezanina +--- + azurelinuxagent/common/osutil/redhat.py | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py +index 9759d113..a02647cd 100644 +--- a/azurelinuxagent/common/osutil/redhat.py ++++ b/azurelinuxagent/common/osutil/redhat.py +@@ -142,3 +142,21 @@ class RedhatOSUtil(Redhat6xOSUtil): + endpoint = self.get_endpoint_from_leases_path('/var/lib/NetworkManager/dhclient-*.lease') + + return endpoint ++ ++ def restart_if(self, ifname, retries=3, wait=5): ++ """ ++ Restart an interface by bouncing the link. ++ """ ++ retry_limit=retries+1 ++ for attempt in range(1, retry_limit): ++ try: ++ shellutil.run_command(["ip", "link", "set", ifname, "down"]) ++ shellutil.run_command(["ip", "link", "set", ifname, "up"]) ++ ++ except shellutil.CommandError as cmd_err: ++ logger.warn("failed to restart {0}: return code {1}".format(ifname, cmd_err.returncode)) ++ if attempt < retry_limit: ++ logger.info("retrying in {0} seconds".format(wait)) ++ time.sleep(wait) ++ else: ++ logger.warn("exceeded restart retries") +-- +2.31.1 + diff --git a/SOURCES/0002-Remove-FIPS-setting-from-the-default-config.patch b/SOURCES/0002-Remove-FIPS-setting-from-the-default-config.patch deleted file mode 100644 index 4f89667..0000000 --- a/SOURCES/0002-Remove-FIPS-setting-from-the-default-config.patch +++ /dev/null @@ -1,40 +0,0 @@ -From cbf8baa1ce97d15ab16e27d21e4e7a74f79a0383 Mon Sep 17 00:00:00 2001 -From: Miroslav Rezanina -Date: Tue, 4 Jul 2017 08:33:29 +0200 -Subject: Remove FIPS setting from the default config - -RH-Author: Miroslav Rezanina -Message-id: <20170704083329.31138-1-mrezanin@redhat.com> -Patchwork-id: 75701 -O-Subject: [RHEL-6/RHEL-7 WALinuxAgent PATCH] Remove FIPS setting from the default config -Bugzilla: 1467553 -RH-Acked-by: Vitaly Kuznetsov -RH-Acked-by: Mohammed Gamal -RH-Acked-by: Eduardo Otubo - -The feature is not fully functional upstream (see BZ#1460671), remove it -from the default config. - -Signed-off-by: Miroslav Rezanina -(cherry picked from commit a48b6136e955ae6d7d6d21564f614dac6347d34e) ---- - config/waagent.conf | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/config/waagent.conf b/config/waagent.conf -index 62a9441..4754029 100644 ---- a/config/waagent.conf -+++ b/config/waagent.conf -@@ -65,9 +65,6 @@ Logs.Verbose=n - # Enable Console logging, default is y - # Logs.Console=y - --# Is FIPS enabled --OS.EnableFIPS=n -- - # Root device timeout in seconds. - OS.RootDeviceScsiTimeout=300 - --- -1.8.3.1 - diff --git a/SOURCES/wa-Fix-if-hangs.patch b/SOURCES/wa-Fix-if-hangs.patch new file mode 100644 index 0000000..bc189af --- /dev/null +++ b/SOURCES/wa-Fix-if-hangs.patch @@ -0,0 +1,120 @@ +From 12848c286008ef850bedb4552d4a8778f3164b00 Mon Sep 17 00:00:00 2001 +From: Mohammed Gamal +Date: Thu, 2 Jun 2022 14:39:42 +0200 +Subject: [PATCH] Fix if hangs (#2283) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2092753 + +Signed-off-by: Laveesh Rohra +(cherry picked from commit 05cd6437ba90928788ef18c8b9fc8a6dbaf47c7d) + +Signed-off-by: Mohammed Gamal +--- + azurelinuxagent/common/osutil/default.py | 26 ++++++++---------------- + azurelinuxagent/common/osutil/ubuntu.py | 22 +++++++++----------- + tests/common/osutil/test_default.py | 11 +++------- + 3 files changed, 21 insertions(+), 38 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py +index 066e1431..820016c1 100644 +--- a/azurelinuxagent/common/osutil/default.py ++++ b/azurelinuxagent/common/osutil/default.py +@@ -1163,25 +1163,15 @@ class DefaultOSUtil(object): + def restart_if(self, ifname, retries=3, wait=5): + retry_limit = retries + 1 + for attempt in range(1, retry_limit): +- try: +- shellutil.run_command(["ifdown", ifname]) +- shellutil.run_command(["ifup", ifname]) ++ return_code = shellutil.run("ifdown {0} && ifup {0}".format(ifname), expected_errors=[1] if attempt < retries else []) ++ if return_code == 0: + return +- except shellutil.CommandError as cmd_err: +- +- msg = "failed to restart {0}: returncode={1}\n[stdout]{2}\n\n[stderr]{3}\n"\ +- .format(ifname, cmd_err.returncode, cmd_err.stdout, cmd_err.stderr) +- +- if cmd_err.returncode == 1: +- logger.info(msg) +- else: +- logger.warn(msg) +- +- if attempt < retry_limit: +- logger.info("retrying in {0} seconds".format(wait)) +- time.sleep(wait) +- else: +- logger.warn("exceeded restart retries") ++ logger.warn("failed to restart {0}: return code {1}".format(ifname, return_code)) ++ if attempt < retry_limit: ++ logger.info("retrying in {0} seconds".format(wait)) ++ time.sleep(wait) ++ else: ++ logger.warn("exceeded restart retries") + + def publish_hostname(self, hostname): + self.set_dhcp_hostname(hostname) +diff --git a/azurelinuxagent/common/osutil/ubuntu.py b/azurelinuxagent/common/osutil/ubuntu.py +index 249e1120..5a21511c 100644 +--- a/azurelinuxagent/common/osutil/ubuntu.py ++++ b/azurelinuxagent/common/osutil/ubuntu.py +@@ -142,19 +142,17 @@ class UbuntuOSUtil(Ubuntu16OSUtil): + Restart an interface by bouncing the link. systemd-networkd observes + this event, and forces a renew of DHCP. + """ +- retry_limit=retries+1 ++ retry_limit = retries+1 + for attempt in range(1, retry_limit): +- try: +- shellutil.run_command(["ip", "link", "set", ifname, "down"]) +- shellutil.run_command(["ip", "link", "set", ifname, "up"]) +- +- except shellutil.CommandError as cmd_err: +- logger.warn("failed to restart {0}: return code {1}".format(ifname, cmd_err.returncode)) +- if attempt < retry_limit: +- logger.info("retrying in {0} seconds".format(wait)) +- time.sleep(wait) +- else: +- logger.warn("exceeded restart retries") ++ return_code = shellutil.run("ip link set {0} down && ip link set {0} up".format(ifname)) ++ if return_code == 0: ++ return ++ logger.warn("failed to restart {0}: return code {1}".format(ifname, return_code)) ++ if attempt < retry_limit: ++ logger.info("retrying in {0} seconds".format(wait)) ++ time.sleep(wait) ++ else: ++ logger.warn("exceeded restart retries") + + + class UbuntuSnappyOSUtil(Ubuntu14OSUtil): +diff --git a/tests/common/osutil/test_default.py b/tests/common/osutil/test_default.py +index 65d7ae0f..d6eae68f 100644 +--- a/tests/common/osutil/test_default.py ++++ b/tests/common/osutil/test_default.py +@@ -49,20 +49,15 @@ class TestOSUtil(AgentTestCase): + # setup + retries = 3 + ifname = 'dummy' +- with patch.object(shellutil, "run_command") as run_patch: +- run_patch.side_effect = shellutil.CommandError("ifupdown dummy", 1, "", "") ++ with patch.object(shellutil, "run") as run_patch: ++ run_patch.return_value = 1 + + # execute + osutil.DefaultOSUtil.restart_if(osutil.DefaultOSUtil(), ifname=ifname, retries=retries, wait=0) + + # assert + self.assertEqual(run_patch.call_count, retries) +- cmd_queue = list(args[0] for (args, _) in run_patch.call_args_list) +- while cmd_queue: +- self.assertEqual(cmd_queue.pop(0), ["ifdown", ifname]) +- # We don't expect the following command to be called because 'dummy' does +- # not exist. +- self.assertNotEqual(cmd_queue[0] if cmd_queue else None, ["ifup", ifname]) ++ self.assertEqual(run_patch.call_args_list[0][0][0], 'ifdown {0} && ifup {0}'.format(ifname)) + + def test_get_dvd_device_success(self): + with patch.object(os, 'listdir', return_value=['cpu', 'cdrom0']): +-- +2.31.1 + diff --git a/SOURCES/wla-Update-Provisioning-options-1853.patch b/SOURCES/wla-Update-Provisioning-options-1853.patch deleted file mode 100644 index 3807b74..0000000 --- a/SOURCES/wla-Update-Provisioning-options-1853.patch +++ /dev/null @@ -1,351 +0,0 @@ -From 3453fe9b9a85d755262f68ef96e2570917b67755 Mon Sep 17 00:00:00 2001 -From: Vitaly Kuznetsov -Date: Wed, 3 Jun 2020 12:21:07 +0200 -Subject: [PATCH] Update 'Provisioning' options (#1853) - -RH-Author: Vitaly Kuznetsov -Message-id: <20200525162420.151669-1-vkuznets@redhat.com> -Patchwork-id: 96748 -O-Subject: [RHEL7.9 WALinuxAgent PATCH] Update 'Provisioning' options (#1853) -Bugzilla: 1822883 -RH-Acked-by: Mohammed Gamal -RH-Acked-by: Miroslav Rezanina - -commit 92b652e031dd01027113702df7ee93c816bfd1aa -Author: Vitaly Kuznetsov -Date: Tue Apr 21 02:01:03 2020 +0200 - - Update 'Provisioning' options (#1853) - - 'Provisioning.Enabled' and 'Provisioning.UseCloudInit' parameters are - removed since v2.2.45 and replaced with 'Provisioning.Agent'. Update - distro specific configs accordingly. - - Signed-off-by: Vitaly Kuznetsov - - Co-authored-by: Vitaly Kuznetsov - -Signed-off-by: Vitaly Kuznetsov -Signed-off-by: Miroslav Rezanina ---- - config/alpine/waagent.conf | 8 +++----- - config/arch/waagent.conf | 8 +++----- - config/bigip/waagent.conf | 8 +++----- - config/clearlinux/waagent.conf | 8 +++----- - config/coreos/waagent.conf | 8 +++----- - config/debian/waagent.conf | 8 +++----- - config/freebsd/waagent.conf | 8 +++----- - config/gaia/waagent.conf | 8 +++----- - config/iosxe/waagent.conf | 8 +++----- - config/nsbsd/waagent.conf | 8 +++----- - config/openbsd/waagent.conf | 8 +++----- - config/suse/waagent.conf | 8 +++----- - config/ubuntu/waagent.conf | 8 +++----- - config/waagent.conf | 8 +++----- - 14 files changed, 42 insertions(+), 70 deletions(-) - -diff --git a/config/alpine/waagent.conf b/config/alpine/waagent.conf -index ac9466e..2a010cf 100644 ---- a/config/alpine/waagent.conf -+++ b/config/alpine/waagent.conf -@@ -2,15 +2,13 @@ - # Windows Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/arch/waagent.conf b/config/arch/waagent.conf -index 8d509cf..f999359 100644 ---- a/config/arch/waagent.conf -+++ b/config/arch/waagent.conf -@@ -2,11 +2,9 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=n -diff --git a/config/bigip/waagent.conf b/config/bigip/waagent.conf -index 7446bcb..49acf9d 100644 ---- a/config/bigip/waagent.conf -+++ b/config/bigip/waagent.conf -@@ -13,15 +13,13 @@ Role.ConfigurationConsumer=None - # Specified program is invoked with XML file argument specifying role topology. - Role.TopologyConsumer=None - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/clearlinux/waagent.conf b/config/clearlinux/waagent.conf -index 10567cc..0b70d26 100644 ---- a/config/clearlinux/waagent.conf -+++ b/config/clearlinux/waagent.conf -@@ -13,11 +13,9 @@ Role.ConfigurationConsumer=None - # Specified program is invoked with XML file argument specifying role topology. - Role.TopologyConsumer=None - --# Enable instance creation --Provisioning.Enabled=y -- --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/coreos/waagent.conf b/config/coreos/waagent.conf -index 8d3312c..0ce7b27 100644 ---- a/config/coreos/waagent.conf -+++ b/config/coreos/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=n -diff --git a/config/debian/waagent.conf b/config/debian/waagent.conf -index 28e496e..4c1880e 100644 ---- a/config/debian/waagent.conf -+++ b/config/debian/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/freebsd/waagent.conf b/config/freebsd/waagent.conf -index 83988ae..1d1710b 100644 ---- a/config/freebsd/waagent.conf -+++ b/config/freebsd/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/gaia/waagent.conf b/config/gaia/waagent.conf -index 6992ff2..b1dc764 100644 ---- a/config/gaia/waagent.conf -+++ b/config/gaia/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=n -diff --git a/config/iosxe/waagent.conf b/config/iosxe/waagent.conf -index 6787d30..533a234 100644 ---- a/config/iosxe/waagent.conf -+++ b/config/iosxe/waagent.conf -@@ -2,11 +2,9 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=n -- --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/nsbsd/waagent.conf b/config/nsbsd/waagent.conf -index 178f9a2..b859fd5 100644 ---- a/config/nsbsd/waagent.conf -+++ b/config/nsbsd/waagent.conf -@@ -2,11 +2,9 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=n -diff --git a/config/openbsd/waagent.conf b/config/openbsd/waagent.conf -index 54f2e11..697f129 100644 ---- a/config/openbsd/waagent.conf -+++ b/config/openbsd/waagent.conf -@@ -2,11 +2,9 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/suse/waagent.conf b/config/suse/waagent.conf -index 5e601e6..dc99b12 100644 ---- a/config/suse/waagent.conf -+++ b/config/suse/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/ubuntu/waagent.conf b/config/ubuntu/waagent.conf -index 759db70..8c2c512 100644 ---- a/config/ubuntu/waagent.conf -+++ b/config/ubuntu/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=n -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=y -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y -diff --git a/config/waagent.conf b/config/waagent.conf -index 4754029..d12bb79 100644 ---- a/config/waagent.conf -+++ b/config/waagent.conf -@@ -2,15 +2,13 @@ - # Microsoft Azure Linux Agent Configuration - # - --# Enable instance creation --Provisioning.Enabled=y -- - # Enable extension handling. Do not disable this unless you do not need password reset, - # backup, monitoring, or any extension handling whatsoever. - Extensions.Enabled=y - --# Rely on cloud-init to provision --Provisioning.UseCloudInit=n -+# Which provisioning agent to use. Supported values are "auto" (default), "waagent", -+# "cloud-init", or "disabled". -+Provisioning.Agent=auto - - # Password authentication for root account will be unavailable. - Provisioning.DeleteRootPassword=y --- -1.8.3.1 - diff --git a/SOURCES/wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch b/SOURCES/wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch new file mode 100644 index 0000000..fadb066 --- /dev/null +++ b/SOURCES/wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch @@ -0,0 +1,39 @@ +From c9c4eb476e9b9e3e00b08811aae0aba7dabc2e4a Mon Sep 17 00:00:00 2001 +From: Mohammed Gamal +Date: Tue, 21 Jun 2022 15:58:49 +0200 +Subject: [PATCH] redhat: Fix command sequence for restarting net interface + +RH-Author: Mohamed Gamal Morsy +RH-MergeRequest: 3: redhat: Fix command sequence for restarting net interface +RH-Commit: [1/1] 32849039225dbb0b912730a232bba21ca2a94b19 +RH-Bugzilla: 2098083 +RH-Acked-by: Vitaly Kuznetsov +RH-Acked-by: Miroslav Rezanina + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2098083 + +Apparently the down and up commands need to be run in the same command, so +connect them together with "&&" operator + +Signed-off-by: Mohammed Gamal +--- + azurelinuxagent/common/osutil/redhat.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py +index a02647cd..840f7a1d 100644 +--- a/azurelinuxagent/common/osutil/redhat.py ++++ b/azurelinuxagent/common/osutil/redhat.py +@@ -150,8 +150,7 @@ class RedhatOSUtil(Redhat6xOSUtil): + retry_limit=retries+1 + for attempt in range(1, retry_limit): + try: +- shellutil.run_command(["ip", "link", "set", ifname, "down"]) +- shellutil.run_command(["ip", "link", "set", ifname, "up"]) ++ shellutil.run_command(["ip", "link", "set", ifname, "down", "&&", "ip", "link", "set", ifname, "up"]) + + except shellutil.CommandError as cmd_err: + logger.warn("failed to restart {0}: return code {1}".format(ifname, cmd_err.returncode)) +-- +2.31.1 + diff --git a/SOURCES/wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch b/SOURCES/wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch new file mode 100644 index 0000000..11fecd2 --- /dev/null +++ b/SOURCES/wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch @@ -0,0 +1,56 @@ +From 085ca05c4dfa8462a100e4218e4570e610f28564 Mon Sep 17 00:00:00 2001 +From: Mohammed Gamal +Date: Thu, 30 Jun 2022 11:54:12 +0200 +Subject: [PATCH] redhat: Implement restart_if correctly to eliminate warnings + +RH-Author: Mohamed Gamal Morsy +RH-MergeRequest: 5: redhat: Implement restart_if correctly to eliminate warnings +RH-Commit: [1/1] 3d4a942dfcc15d36607455175191a9a67196d76d +RH-Bugzilla: 2098083 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Vitaly Kuznetsov + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2098083 + +restart_if seems to generate some warnings. As errors are not handled correctly. +Implement restart_if() the same wat as default.py, but with RH supported commands +instead + +Signed-off-by: Mohammed Gamal +--- + azurelinuxagent/common/osutil/redhat.py | 21 ++++++++++----------- + 1 file changed, 10 insertions(+), 11 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py +index 840f7a1d..5c397ae8 100644 +--- a/azurelinuxagent/common/osutil/redhat.py ++++ b/azurelinuxagent/common/osutil/redhat.py +@@ -147,15 +147,14 @@ class RedhatOSUtil(Redhat6xOSUtil): + """ + Restart an interface by bouncing the link. + """ +- retry_limit=retries+1 ++ retry_limit = retries + 1 + for attempt in range(1, retry_limit): +- try: +- shellutil.run_command(["ip", "link", "set", ifname, "down", "&&", "ip", "link", "set", ifname, "up"]) +- +- except shellutil.CommandError as cmd_err: +- logger.warn("failed to restart {0}: return code {1}".format(ifname, cmd_err.returncode)) +- if attempt < retry_limit: +- logger.info("retrying in {0} seconds".format(wait)) +- time.sleep(wait) +- else: +- logger.warn("exceeded restart retries") ++ return_code = shellutil.run("ip link set {0} down && ip link set {0} up".format(ifname), expected_errors=[1] if attempt < retries else []) ++ if return_code == 0: ++ return ++ logger.warn("failed to restart {0}: return code {1}".format(ifname, return_code)) ++ if attempt < retry_limit: ++ logger.info("retrying in {0} seconds".format(wait)) ++ time.sleep(wait) ++ else: ++ logger.warn("exceeded restart retries") +-- +2.31.1 + diff --git a/SPECS/WALinuxAgent.spec b/SPECS/WALinuxAgent.spec index d4bbeb1..5d5746f 100644 --- a/SPECS/WALinuxAgent.spec +++ b/SPECS/WALinuxAgent.spec @@ -1,7 +1,7 @@ %define name WALinuxAgent -%define version 2.2.46 -%define unmangled_version 2.2.46 -%define release 2 +%define version 2.3.0.2 +%define unmangled_version 2.3.0.2 +%define release 4 %if 0%{?rhel} < 7 %global initsys sysV @@ -13,10 +13,14 @@ Summary: Microsoft Azure Linux Agent Name: %{name} Version: %{version} Release: %{release}%{?dist} -Source0: WALinuxAgent-2.2.46.tar.gz -Patch0002: 0002-Remove-FIPS-setting-from-the-default-config.patch -# For bz#1822883 - [Azure][RHEL-7]Some parameter changes are not in waagent.conf -Patch3: wla-Update-Provisioning-options-1853.patch +Source0: WALinuxAgent-2.3.0.2.tar.gz +Patch0001: 0001-Add-inital-redhat-build-support.patch +Patch0002: 0002-Implement-restart_if-for-RedHat-OS.patch +Patch0003: wa-Fix-if-hangs.patch +# For bz#2098083 - [Azure][WALA] walinuxagent kills network during boot [rhel-7.9.z] +Patch4: wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch +# For bz#2098083 - [Azure][WALA] walinuxagent kills network during boot [rhel-7.9.z] +Patch5: wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch License: ASL 2.0 Group: Development/Libraries @@ -69,16 +73,19 @@ images that are built to run in the Azure environment. %prep -%setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version} +%setup -n %{name}-%{unmangled_version} -q +%patch0001 -p1 %patch0002 -p1 -%patch3 -p1 +%patch0003 -p1 +%patch4 -p1 +%patch5 -p1 %build -python setup.py build +%{__python2} setup.py build %install -python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES +%{__python2} setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES %clean rm -rf $RPM_BUILD_ROOT @@ -117,17 +124,34 @@ fi %files %defattr(-,root,root) -%{python_sitelib}/* +%{python2_sitelib}/* %config(noreplace) %{_sysconfdir}/waagent.conf -%{_sysconfdir}/logrotate.d/waagent.logrotate +%config(noreplace) %{_sysconfdir}/logrotate.d/waagent.logrotate %{_sbindir}/waagent %{_sbindir}/waagent2.0 %{_unitdir}/waagent.service /etc/udev/rules.d/66-azure-storage.rules /etc/udev/rules.d/99-azure-product-uuid.rules -/etc/logrotate.d/waagent-extn.logrotate %changelog +* Mon Jul 11 2022 Miroslav Rezanina - 2.3.0.2-4 +- wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch [bz#2098083] +- Resolves: bz#2098083 + ([Azure][WALA] walinuxagent kills network during boot [rhel-7.9.z]) + +* Wed Jun 29 2022 Miroslav Rezanina - 2.3.0.2-3 +- wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch [bz#2098083] +- Resolves: bz#2098083 + ([Azure][WALA] walinuxagent kills network during boot [rhel-7.9.z]) + +* Fri Jun 10 2022 Miroslav Rezanina - 2.3.0.2-2 +- Fixing boot hang [bz#2092753] + +* Tue May 31 2022 Miroslav Rezanina - 2.3.0.2-1 +- Rebase to 2.3.0.2 [bz#2082801] +- Resolves: bz#2082801 + ([Azure][RHEL-7]The package WALinuxAgent needs least supported version by July 2022) + * Wed Jun 03 2020 Miroslav Rezanina - 2.2.46-2 - wla-Update-Provisioning-options-1853.patch [bz#1822883] - Resolves: bz#1822883