Skip to content

Improve ProxmoxVE config flow preparing bug fixing#169682

Draft
CoMPaTech wants to merge 3 commits intohome-assistant:devfrom
CoMPaTech:proxmox_fix
Draft

Improve ProxmoxVE config flow preparing bug fixing#169682
CoMPaTech wants to merge 3 commits intohome-assistant:devfrom
CoMPaTech:proxmox_fix

Conversation

@CoMPaTech
Copy link
Copy Markdown
Member

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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 3, 2026

Hey there @Corbeno, @erwindouna, mind taking a look at this pull request as it has been labeled with an integration (proxmoxve) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of proxmoxve can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign proxmoxve Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread homeassistant/components/proxmoxve/config_flow.py
Comment on lines +318 to +325
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"
Comment thread homeassistant/components/proxmoxve/strings.json Outdated
Comment thread homeassistant/components/proxmoxve/strings.json Outdated
@CoMPaTech CoMPaTech marked this pull request as ready for review May 3, 2026 11:27
@CoMPaTech CoMPaTech requested a review from erwindouna as a code owner May 3, 2026 11:27
Copilot AI review requested due to automatic review settings May 3, 2026 11:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/proxmoxve/config_flow.py
Comment thread homeassistant/components/proxmoxve/config_flow.py
Comment thread homeassistant/components/proxmoxve/config_flow.py
Copy link
Copy Markdown
Member

@erwindouna erwindouna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attack trace is outputted by default, right, when an exception is caught?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread homeassistant/components/proxmoxve/config_flow.py Outdated
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 3, 2026

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot marked this pull request as draft May 3, 2026 12:38
Co-authored-by: Erwin Douna <e.douna@gmail.com>
Copilot AI review requested due to automatic review settings May 3, 2026 12:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/proxmoxve/config_flow.py
Comment thread homeassistant/components/proxmoxve/config_flow.py
Comment thread homeassistant/components/proxmoxve/strings.json
Comment thread homeassistant/components/proxmoxve/strings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants