fix: guard PasswordExec against None host/port/username - #10326
Conversation
Service-only connections (pg_service.conf) leave host, port and username unset, so a per-server Password Exec Command crashed in get() with TypeError: replace() argument 2 must be str, not None. Fall back to an empty string for each unset placeholder instead. Closes pgadmin-org#10237
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review. Walkthrough
ChangesPassword Exec service-only connections
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change safely handles unset host, port, and username values by substituting empty strings; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
pg_service.confwith host/port/username left blank) crashed a per-server Password Exec Command withTypeError: replace() argument 2 must be str, not None, becausePasswordExec.get()passedNonestraight intostr.replace().%HOSTNAME%,%PORT%and%USERNAME%placeholders now fall back to an empty string when the corresponding attribute is unset.Test plan
web/pgadmin/utils/tests/test_passexec.py, verified it fails against the pre-fix code and passes with the fix.pycodestyleclean on both changed files.Closes #10237
Summary by CodeRabbit
Bug Fixes
Tests