cloud-init add patch for PPS support of auzre-proxy-agent (#10455)
Co-authored-by: minghe <rmhsawyer>
This commit is contained in:
Родитель
d37a414769
Коммит
85a79aff0e
|
@ -0,0 +1,94 @@
|
|||
From 19442eedae2a3f96d424626dad20e037f10f147b Mon Sep 17 00:00:00 2001
|
||||
From: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
|
||||
Date: Tue, 13 Aug 2024 09:44:25 -0700
|
||||
Subject: [PATCH] add PPS support for azure-proxy-agent
|
||||
|
||||
---
|
||||
cloudinit/sources/DataSourceAzure.py | 23 +++++++++++++++++++++--
|
||||
cloudinit/sources/azure/errors.py | 5 +----
|
||||
tests/unittests/sources/test_azure.py | 5 ++++-
|
||||
3 files changed, 26 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
|
||||
index c2f74e173..aed740b89 100644
|
||||
--- a/cloudinit/sources/DataSourceAzure.py
|
||||
+++ b/cloudinit/sources/DataSourceAzure.py
|
||||
@@ -504,15 +504,31 @@ class DataSourceAzure(sources.DataSource):
|
||||
]
|
||||
out, err = subp.subp(cmd)
|
||||
report_diagnostic_event(
|
||||
- "Running azure-proxy-agent %s resulted"
|
||||
- "in stderr output: %s with stdout: %s" % (cmd, err, out),
|
||||
+ "Executing %s resulted "
|
||||
+ "in stderr=%r with stdout=%r" % (cmd, err, out),
|
||||
logger_func=LOG.debug,
|
||||
)
|
||||
except subp.ProcessExecutionError as error:
|
||||
if isinstance(error.reason, FileNotFoundError):
|
||||
+ LOG.error(
|
||||
+ "Failed to activate Azure Guest Proxy Agent: "
|
||||
+ "azure-proxy-agent not found"
|
||||
+ )
|
||||
report_error = errors.ReportableErrorProxyAgentNotFound()
|
||||
self._report_failure(report_error)
|
||||
else:
|
||||
+ report_diagnostic_event(
|
||||
+ "Failed to activate Azure Guest Proxy Agent: "
|
||||
+ "status check failed "
|
||||
+ "cmd=%r stderr=%r stdout=%r exit_code=%s"
|
||||
+ % (
|
||||
+ error.cmd,
|
||||
+ error.stderr,
|
||||
+ error.stdout,
|
||||
+ error.exit_code,
|
||||
+ ),
|
||||
+ logger_func=LOG.error,
|
||||
+ )
|
||||
reportable_error = (
|
||||
errors.ReportableErrorProxyAgentStatusFailure(error)
|
||||
)
|
||||
@@ -637,6 +653,9 @@ class DataSourceAzure(sources.DataSource):
|
||||
self._wait_for_pps_unknown_reuse()
|
||||
|
||||
md, userdata_raw, cfg, files = self._reprovision()
|
||||
+ if cfg.get("ProvisionGuestProxyAgent"):
|
||||
+ self._check_azure_proxy_agent_status()
|
||||
+
|
||||
# fetch metadata again as it has changed after reprovisioning
|
||||
imds_md = self.get_metadata_from_imds(report_failure=True)
|
||||
|
||||
diff --git a/cloudinit/sources/azure/errors.py b/cloudinit/sources/azure/errors.py
|
||||
index b331cd686..6595ceda9 100644
|
||||
--- a/cloudinit/sources/azure/errors.py
|
||||
+++ b/cloudinit/sources/azure/errors.py
|
||||
@@ -155,10 +155,7 @@ class ReportableErrorUnhandledException(ReportableError):
|
||||
|
||||
class ReportableErrorProxyAgentNotFound(ReportableError):
|
||||
def __init__(self) -> None:
|
||||
- super().__init__(
|
||||
- "Unable to activate Azure Guest Proxy Agent."
|
||||
- "azure-proxy-agent not found"
|
||||
- )
|
||||
+ super().__init__("azure-proxy-agent not found")
|
||||
|
||||
|
||||
class ReportableErrorProxyAgentStatusFailure(ReportableError):
|
||||
diff --git a/tests/unittests/sources/test_azure.py b/tests/unittests/sources/test_azure.py
|
||||
index 9b6672e1e..446d5bf31 100644
|
||||
--- a/tests/unittests/sources/test_azure.py
|
||||
+++ b/tests/unittests/sources/test_azure.py
|
||||
@@ -4532,7 +4532,10 @@ class TestCheckAzureProxyAgent:
|
||||
subp.SubpResult("Guest Proxy Agent running", ""),
|
||||
]
|
||||
self.azure_ds._check_azure_proxy_agent_status()
|
||||
- assert "Running azure-proxy-agent" in self.caplog.text
|
||||
+ assert (
|
||||
+ "Executing ['azure-proxy-agent', '--status', '--wait', '120']"
|
||||
+ in self.caplog.text
|
||||
+ )
|
||||
assert self.mock_wrapping_report_failure.mock_calls == []
|
||||
|
||||
def test_check_azure_proxy_agent_status_notfound(self):
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -5,7 +5,7 @@ Summary: Cloud instance init scripts
|
|||
Name: cloud-init
|
||||
Epoch: 1
|
||||
Version: %{package_version}
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: GPLv3
|
||||
Vendor: Microsoft Corporation
|
||||
Distribution: Mariner
|
||||
|
@ -19,6 +19,7 @@ Patch2: Add-Network-Interface-Renaming-Support-for-CAPM3-Met.patch
|
|||
Patch3: 0001-feat-azure-Add-ProvisionGuestProxyAgent-OVF-setting.patch
|
||||
Patch4: 0002-feat-azure-parse-ProvisionGuestProxyAgent-as-bool-51.patch
|
||||
Patch5: 0003-feat-azure-add-support-for-azure-proxy-agent.patch
|
||||
Patch6: 0001-add-PPS-support-for-azure-proxy-agent.patch
|
||||
%define cl_services cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
|
||||
BuildRequires: automake
|
||||
BuildRequires: dbus
|
||||
|
@ -154,6 +155,9 @@ make check %{?_smp_mflags}
|
|||
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/10-azure-kvp.cfg
|
||||
|
||||
%changelog
|
||||
* Fri Sep 13 2024 Minghe Ren <mingheren@microsoft.com> - 1:23.3-5
|
||||
- Add patche to have PPS support for azure-proxy-agent.
|
||||
|
||||
* Wed Sep 04 2024 Minghe Ren <mingheren@microsoft.com> - 1:23.3-4
|
||||
- Add patches to support azure-proxy-agent.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче