Skip to content

fix: realm_type mapping, ha_groups crash on PVE 9.1, zero config values, token auth via $(...) - #98

Open
lcaflc wants to merge 4 commits into
mainfrom
fix/user-ha-config-auth
Open

lcaflc wants to merge 4 commits into
mainfrom
fix/user-ha-config-auth

Conversation

@lcaflc

@lcaflc lcaflc commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Four independent bug fixes, one commit each, each with a test that fails without the fix.

  • fix(user): map the realm-type API key to realm_type. The API returns realm-type, the model read realm_type, so the column was always empty in user list and in the report. The report test now asserts the value, not just the key.
  • fix(sanitycheck): skip non node-affinity HA rules in ha_groups. Since PVE 9.1, cluster/ha/rules also returns resource-affinity rules, which have no nodes key. The check raised KeyError: 'nodes' and aborted the whole sanitycheck. Adds a fake_ha_resource_affinity_rule fixture and tests for the check.
  • fix(config): keep explicit zero values in per-cluster node and vm settings. The fallback to global settings tested truthiness, so a per-cluster memoryminimum: 0 (documented in the README) was replaced by the global value. Now only None / missing keys fall back.
  • fix(auth): return command substitution output as text. $(command) returned bytes. proxmoxer 2.3.0 builds the token header with str.format, producing PVEAPIToken=b'root@pam'!b'ci'=b'abcd', so token auth with $(...) could not work. proxy_certificate JSON is now parsed from the str output. Adds tests for run_auth_commands.

Note: #83 also fixes the realm-type mapping as part of the dataclass refactor; the two will conflict on models/user.py, trivially.

lcaflc added 4 commits October 5, 2026 21:22
The Proxmox API returns the realm type as "realm-type" but PVEUser only
read "realm_type", so the column was always empty in user list and in
the report.
Since PVE 9.1, cluster/ha/rules also returns resource-affinity rules,
which have no nodes key. The ha_groups check raised a KeyError on them
and aborted the whole sanitycheck run.
…tings

The fallback to the global node and vm settings tested the value for
truthiness, so a per-cluster memoryminimum: 0 (documented in the README)
was silently replaced by the global value.
$(command) substitution returned bytes. proxmoxer builds the API token
header with str.format, which produced PVEAPIToken=b'user'!b'name'=b'value'
and broke token authentication. The proxy_certificate JSON is now parsed
from the str output.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant