← Back to issue list

lxd: friendly errror with suggestions if network is broken

View original Github issue

Metadata

Project
snapcraft
Number
#1930
Type
pull request
State
merged
Author
kalikiana
Labels
—
Created
Updated
Closed

Current evaluation

Merged in snapcraft#1930 (cdbac658d), replacing raw LXD network-probe failures with friendly errors that include the checked URL and guidance.

Resolution: closed resolved

Reason: Pull request #1930 was approved and merged as commit cdbac658d, adding explicit network exception handling and updating unit tests.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- As evidenced by [LP: #1749679](https://bugs.launchpad.net/snapcraft/+bug/1749679) the verbatim network probing failures aren't very helpful. We can try to reduce noise and give some hints as to what's wrong. `ContainerConnectionError` will ensure there's a link to LXD docs and the URL we check is mentioned in the message. `urllib.error.URLError` is handled explicitly to get a niceish error message in the case of connection errors. All other exceptions will generically be caught as well since we don't want a stack trace in any event and **urllib** can leak other exceptions such as `UnicodeError`. Fixes: [LP: #1719952](https://bugs.launchpad.net/snapcraft/+bug/1719952) The following tests were updated: - tests.unit.commands.test_snap - tests.unit.test_lxd I locally ran the tests: - `./runtests.sh tests/unit` with unrelated failures in [tests.unit.test_lifecycle.CoreSetupTestCase.test_core_setup_if_docker_env](https://bugs.launchpad.net/snapcraft/+bug/1752576), `tests.unit.test_mangling.TestClearExecstack.test_execstack_clears` and `tests.unit.test_elf`. - `./runtests.sh tests/integration` with one unrelated failure in [tests.integration.general.test_parser.TestParserWikis](https://bugs.launchpad.net/snapcraft/+bug/1752580) - `./runtests.sh static`: Everything passed Manual test steps: - cd tests/integration/snaps/basic - snapcraft cleanbuild - lxc profile set default environment.http_proxy localhost:1234 - Observe `Failed to open 'http://start.ubuntu.com/connectivity-check.html': [Errno 111] Connection refused` - lxc profile set default environment.http_proxy invalid - Observe `Failed to open 'http://start.ubuntu.com/connectivity-check.html': [Errno -2] Name or service not known` - lxc profile set default environment.http_proxy http://unknown - Observe `Failed to open 'http://start.ubuntu.com/connectivity-check.html': [Errno -2] Name or service not known` - lxc profile set default environment.http_proxy .invalid - Observe `Failed to open 'http://start.ubuntu.com/connectivity-check.html': encoding with 'idna' codec failed (UnicodeError: label empty or too long)` Note: Use `lxc profile set default environment.http_proxy ''` to unset the proxy in the default LXD profile after testing, or set it to the value you were using previously.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1930 (cdbac658d), replacing raw LXD network-probe failures with friendly errors that include the checked URL and guidance.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1930 (cdbac658d), adding friendly LXD network failure messages, explicit exception handling, the checked URL, and updated tests.
qwen/qwen3.6-35b-a3b — — Merged improvements to LXD network error handling replace raw stack traces with user-friendly messages and troubleshooting hints. The update explicitly catches connection and encoding exceptions, updates tests, and resolves Launchpad bug #1719952.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Replaces raw LXD network traces with user-friendly error messages and hints. Handles urllib and container exceptions to prevent stack traces, updates tests, and resolves LP: #1719952.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#343 lxd should be a suggestion, not a direct dep snapcraft merged Merged in snapcraft PR #343 as 7147a43ba, changing LXD from a direct dependency to a suggestion and resolving LP #1550381.
76%
#1647 lxd: better surfacing of errors snapcraft merged Merged in snapcraft#1647 as commit 71f48bdc9, improving LXD error handling so callers return silent, correctly coded errors without printing messages twice.
75%
#1550381 lxd should be a suggestion, not a direct dependency snapcraft (launchpad) closed LXD was changed from a direct dependency to a suggestion in canonical/snapcraft PR #343 (commit 7147a43ba), resolving Launchpad #1550381.
72%