Improve ProxmoxVE config flow preparing bug fixing#169682
Improve ProxmoxVE config flow preparing bug fixing#169682CoMPaTech wants to merge 3 commits intohome-assistant:devfrom
Conversation
|
Hey there @Corbeno, @erwindouna, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR refines the Proxmox VE config flow so initialization-time API failures are distinguished from later node/VM lookup failures, aiming to improve the error surfaced during setup, especially around token-based authentication.
Changes:
- Split Proxmox client initialization from the first
nodes.get()call and introduced separate internal exceptions for init failures and VM/LXC lookup failures. - Added new config-flow/user-facing strings for the new error cases and updated existing wording.
- Expanded config-flow tests and test fixtures to inject constructor-time failures separately from node lookup failures.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
homeassistant/components/proxmoxve/config_flow.py |
Refactors setup validation error handling and introduces new Proxmox-specific exception mappings. |
homeassistant/components/proxmoxve/strings.json |
Adds/updates translated config-flow and exception messages for the new error paths. |
tests/components/proxmoxve/conftest.py |
Extends the mocked Proxmox client fixture so tests can trigger constructor-time failures. |
tests/components/proxmoxve/test_config_flow.py |
Updates and adds config-flow tests for init, node, and VM/LXC exception scenarios. |
| except ProxmoxInitFailed as exc: | ||
| errors["base"] = "api_error_no_details" | ||
| err = exc | ||
| except ProxmoxNoNodesFound as exc: | ||
| errors["base"] = "no_nodes_found" | ||
| err = exc | ||
| except ProxmoxNoVMLXCFound as exc: | ||
| errors["base"] = "no_vmlxc_found" |
erwindouna
left a comment
There was a problem hiding this comment.
Minor details and I think we're good to go, @CoMPaTech! :)
| except ConnectTimeout as err: | ||
| raise ProxmoxConnectTimeout from err | ||
| except ResourceException as err: | ||
| _LOGGER.debug("Error fetching nodes", exc_info=True) |
There was a problem hiding this comment.
The attack trace is outputted by default, right, when an exception is caught?
There was a problem hiding this comment.
If so both users on the issue would have had logs, so I doubt it's by default (also looking at other config_flows), but I might be mistaken
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Erwin Douna <e.douna@gmail.com>
Proposed change
Improvement of the config_flow raising specific instead of generic 'no nodes found' as a prequel to provide a fix for API Token authentication as raised by #169295
(and a mypy nitpick)
This basically splits the try for API init and the initial
nodes.get()while returning no vm/lxc instead of raising no nodes.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: