summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorChris Patterson <cpatterson@microsoft.com>2023-01-05 15:32:18 -0500
committerGitHub <noreply@github.com>2023-01-05 14:32:18 -0600
commit8a155c7404aea8728c697f4a4b2d1d24dcf4d0ec (patch)
treeff35de70bb4d44aaead4e1079780aa10cebf156f /cloudinit/sources
parent65557c34bb1aa31a753f19db6a57a3e6ef1c2e39 (diff)
downloadcloud-init-git-8a155c7404aea8728c697f4a4b2d1d24dcf4d0ec.tar.gz
sources/azure: drop description for report_failure_to_fabric() (#1934)
The same default description is used for all error cases. Remove this parameter in favor of assuming the default in all cases. Future work will allow for error reporting with a customizable description using a different interface. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceAzure.py16
-rw-r--r--cloudinit/sources/helpers/azure.py5
2 files changed, 6 insertions, 15 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index c65e17a7..55b8db85 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -31,7 +31,6 @@ from cloudinit.net.ephemeral import EphemeralDHCPv4
from cloudinit.reporting import events
from cloudinit.sources.helpers import netlink
from cloudinit.sources.helpers.azure import (
- DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGE,
DEFAULT_WIRESERVER_ENDPOINT,
BrokenAzureDataSource,
ChassisAssetTag,
@@ -752,9 +751,7 @@ class DataSourceAzure(sources.DataSource):
report_diagnostic_event(
"Could not crawl Azure metadata: %s" % e, logger_func=LOG.error
)
- self._report_failure(
- description=DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGE
- )
+ self._report_failure()
return False
finally:
self._teardown_ephemeral_networking()
@@ -1384,7 +1381,7 @@ class DataSourceAzure(sources.DataSource):
return reprovision_data
@azure_ds_telemetry_reporter
- def _report_failure(self, description: Optional[str] = None) -> bool:
+ def _report_failure(self) -> bool:
"""Tells the Azure fabric that provisioning has failed.
@param description: A description of the error encountered.
@@ -1397,10 +1394,7 @@ class DataSourceAzure(sources.DataSource):
"to report failure to Azure",
logger_func=LOG.debug,
)
- report_failure_to_fabric(
- endpoint=self._wireserver_endpoint,
- description=description,
- )
+ report_failure_to_fabric(endpoint=self._wireserver_endpoint)
return True
except Exception as e:
report_diagnostic_event(
@@ -1420,9 +1414,7 @@ class DataSourceAzure(sources.DataSource):
except NoDHCPLeaseError:
# Reporting failure will fail, but it will emit telemetry.
pass
- report_failure_to_fabric(
- endpoint=self._wireserver_endpoint, description=description
- )
+ report_failure_to_fabric(endpoint=self._wireserver_endpoint)
return True
except Exception as e:
report_diagnostic_event(
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py
index d3467769..d4fc04e2 100644
--- a/cloudinit/sources/helpers/azure.py
+++ b/cloudinit/sources/helpers/azure.py
@@ -1053,10 +1053,9 @@ def get_metadata_from_fabric(
@azure_ds_telemetry_reporter
-def report_failure_to_fabric(endpoint: str, description: Optional[str] = None):
+def report_failure_to_fabric(endpoint: str):
shim = WALinuxAgentShim(endpoint=endpoint)
- if not description:
- description = DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGE
+ description = DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGE
try:
shim.register_with_azure_and_report_failure(description=description)
finally: