summaryrefslogtreecommitdiff
path: root/cloudinit/sources/azure/errors.py
Commit message (Collapse)AuthorAgeFilesLines
* azure/errors: introduce reportable errors for imds (#3647)Chris Patterson2023-05-121-1/+40
| | | | | | | | | | | | | | | Always report failure to host, but report failure to fabric only outside of _check_if_nic_is_primary() which is expected to fail if nic is not primary. Add two types of reportable errors for IMDS metadata: - add ReportableErrorImdsUrlError() for url errors. - add ReportableErrorImdsMetadataParsingException() for parsing errors. Tweak ReportableError repr to be a bit friendlier. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
* azure/errors: add host reporting for dhcp errors (#2167)Chris Patterson2023-05-111-0/+15
| | | | | | | | | | | | | | | | | | | | | | | - Add host_only flag to _report_failure() to allow caller to only report the failure to host. This is for cases where we don't want _report_failure() to attempt DHCP or we expect that we may recover from the reported error (there is no issue reporting multiple times to host, whereas fabric reports will immediately fail the VM provisioning). - Add ReportableErrorDhcpLease() to report lease failures. - Add ReportableErrorDhcpInterfaceNotFound() to report errors where the DHCP interface hasn't been found yet. - Add TestReportFailure class with new test coverage. Will migrate other _report_failure() tests in the future as they currently depend on TestAzureDataSource/CiTestCase. Future work will add the interface name to supporting data, but as that information is not available with iface=None, another PR will explicitly add a call to net.find_fallback_nic() to specify it. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
* sources/azure: report success to host and introduce kvp module (#2141)Chris Patterson2023-04-281-16/+22
| | | | | | | | | | | | Add success reporting to the host via KVP. - Move _report_failure_to_host() into kvp module. - Tweak error description to use result=error instead of PROVISIONING_ERROR: ... - Use result=success for the successful ("ready") reports. - report_x_via_kvp => report_x_to_host for consistency with fabric. ReportableError.as_description() => as_encoded_report() Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
* azure/errors: treat traceback_base64 as string (#2131)Chris Patterson2023-04-191-1/+1
| | | | | | Save a few characters by decoding it as utf-8 string rather than using the bytes representation. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
* azure/errors: introduce reportable errors (#2129)Chris Patterson2023-04-191-0/+93
When provisioning failures occur an Azure, a generic description is used in the report and ultimately returned to the user. To improve the user experience, report details of the failure in a manner that is parsable, readable and succinct. The current approach is to use csv with a custom delimiter ("|") and quote character ("'"). This format may change in the future. Gracefully handle reportable errors thrown while crawling metadata and treat other exceptions as ReportableErrorUnhandledException. Future work will introduce more reportable errors to handle the expected failure cases. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>