-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make exception handling explicit #5202
Make exception handling explicit #5202
Commits on Sep 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 48781ce - Browse repository at this point
Copy the full SHA 48781ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for f5622b7 - Browse repository at this point
Copy the full SHA f5622b7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f866e8 - Browse repository at this point
Copy the full SHA 9f866e8View commit details -
chore(debain): Remove obsolete helper function
From this helper's docstring: Ubuntu cloud images previously included a 'eth0.cfg' that had hard coded content. That file would interfere with the rendered configuration if it was present. This code is no longer relevant due to the following: 1) Ubuntu uses netplan 2) This appears like an Ubuntu-specific workaround 3) Debian cloud images use netplan
Configuration menu - View commit details
-
Copy full SHA for abe431e - Browse repository at this point
Copy the full SHA abe431eView commit details -
refactor(net): Simplify read_sys_net exception handling
Remove unnecessary arguments.
Configuration menu - View commit details
-
Copy full SHA for 324926c - Browse repository at this point
Copy the full SHA 324926cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b65a27 - Browse repository at this point
Copy the full SHA 3b65a27View commit details -
chore(json): Simplify json loading
Since Python 3.6, json.loads() is capable of receiving arguments of type str, bytes, and bytearray. Cloud-init's code historically manually handled type conversion. This boilerplate is no longer necessary. Add docstring and typing to util.load_json().
Configuration menu - View commit details
-
Copy full SHA for eec8f50 - Browse repository at this point
Copy the full SHA eec8f50View commit details
Commits on Sep 30, 2024
-
chore: Make exception handling more explicit
Cloud-init's codebase makes extensive use of exception handlers which catch Exception and then do something based on the assumed exception type. This is bad practice and makes it possible for exceptions to be unexpectedly ignored. To remedy this, this commit updates cloud-init to make `Exception` always be an unknown exception which therefore should always produce a log of level `WARN` or higher. Require a minimum of one of the following in each Exception handler: - LOG.warning("Unhandled exception: %s", e) - util.logexc() - with a log level of WARN or higher - re-raise the exception without setting exception type when re-raising[1] Make cloud-init's code adhere to the above set of rules with the following changes: - Limit the scope where Exception is handled to only unexpected error paths. - Add new handlers for more specific exception types. - Add warning logs or increase log level to WARN in some cases. - Add typing where exceptions are returned. - Replace various Exception handlers with ProcessExecutionError. - Remove handling that does nothing. - Remove unused code which handles Exception. [1] This would likely reduce the scope of the exception and make it possible to mask an Exception.
Configuration menu - View commit details
-
Copy full SHA for 56ad063 - Browse repository at this point
Copy the full SHA 56ad063View commit details
Commits on Oct 1, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 02b775d - Browse repository at this point
Copy the full SHA 02b775dView commit details -
chore(IOError): Update IOError to OSError
In Python 3.3+, IOError is an alias of OSError[1]. Some call sites use one or the other or both. Standardize on the OSError. [1] https://docs.python.org/3/library/exceptions.html#IOError
Configuration menu - View commit details
-
Copy full SHA for 5294901 - Browse repository at this point
Copy the full SHA 5294901View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1786f9d - Browse repository at this point
Copy the full SHA 1786f9dView commit details