[PR #62] [MERGED] fix(ssh): guard ssh_user extraction against None api_user #100

Closed
opened 2026-03-02 15:47:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/PegaProx/project-pegaprox/pull/62
Author: @ry-ops
Created: 2/21/2026
Status: Merged
Merged: 2/26/2026
Merged by: @mkellermann97

Base: mainHead: fix/ssh-user-null-fallback


📝 Commits (1)

  • 7fecfd0 fix(ssh): guard ssh_user extraction against None api_user

📊 Changes

1 file changed (+11 additions, -11 deletions)

View changed files

📝 pegaprox_multi_cluster.py (+11 -11)

📄 Description

Summary

In 11 places the code derived the SSH username with:

ssh_user = api_user.split('@')[0] if '@' in api_user else api_user

If api_user is None (misconfigured cluster, corrupted DB row, or unexpected API response), the '@' in api_user test raises TypeError and the entire SSH operation fails with an unreadable traceback instead of a meaningful error message.

Fix: Consolidate all 11 occurrences to the null-safe one-liner already used in some newer code paths:

ssh_user = (api_user or 'root').split('@')[0]

This is functionally identical for any non-None string value and falls back to 'root' — the expected Proxmox API user — when the value is absent.

Test plan

  • Configure a cluster with an intentionally blank API user — SSH-dependent operations should fail gracefully with a connection error, not a TypeError
  • Normal SSH operations (node shell, rolling updates, HA checks) continue to work as before

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/PegaProx/project-pegaprox/pull/62 **Author:** [@ry-ops](https://github.com/ry-ops) **Created:** 2/21/2026 **Status:** ✅ Merged **Merged:** 2/26/2026 **Merged by:** [@mkellermann97](https://github.com/mkellermann97) **Base:** `main` ← **Head:** `fix/ssh-user-null-fallback` --- ### 📝 Commits (1) - [`7fecfd0`](https://github.com/PegaProx/project-pegaprox/commit/7fecfd02f794868857e8655bb47487f090577e17) fix(ssh): guard ssh_user extraction against None api_user ### 📊 Changes **1 file changed** (+11 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `pegaprox_multi_cluster.py` (+11 -11) </details> ### 📄 Description ## Summary In 11 places the code derived the SSH username with: ```python ssh_user = api_user.split('@')[0] if '@' in api_user else api_user ``` If `api_user` is `None` (misconfigured cluster, corrupted DB row, or unexpected API response), the `'@' in api_user` test raises `TypeError` and the entire SSH operation fails with an unreadable traceback instead of a meaningful error message. **Fix:** Consolidate all 11 occurrences to the null-safe one-liner already used in some newer code paths: ```python ssh_user = (api_user or 'root').split('@')[0] ``` This is functionally identical for any non-None string value and falls back to `'root'` — the expected Proxmox API user — when the value is absent. ## Test plan - [ ] Configure a cluster with an intentionally blank API user — SSH-dependent operations should fail gracefully with a connection error, not a `TypeError` - [ ] Normal SSH operations (node shell, rolling updates, HA checks) continue to work as before 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 15:47:54 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/project-pegaprox-PegaProx#100
No description provided.