Repository navigation
fix: point users to --api-key when rp login fails - #678
marie-karpinska wants to merge 2 commits into
Conversation
The failure branch of rp login now prints the console settings URL and the rp login --api-key command so a user who hits a login error sees a working alternative without looking it up.
when the daily update cache has a newer runpod cached, the login error appends a line pointing to pip install -U runpod. silent when there's no newer version.
|
#675 already provides hint on error |
| f"{exc}\n\n" | ||
| "if rp login keeps failing, grab a key from " | ||
| "https://console.runpod.io/user/settings and run:\n" | ||
| " rp login --api-key YOUR_KEY" |
There was a problem hiding this comment.
If the failing run was rp login --profile staging, following this hint as written stores the key under the default profile, so the next rp --profile staging ... still has no credentials. Could the hint include --profile {profile} when it isn't the default?
| # -- passive background check ------------------------------------------- | ||
|
|
||
|
|
||
| def cached_newer_version() -> Optional[str]: |
There was a problem hiding this comment.
The four branches here (no or stale cache, missing latest_version, same or older, newer) aren't covered, and they decide whether a failing login suggests an upgrade. A small parametrized test over a temp CACHE_PATH would pin them, including a pre-release like 2.0.0rc1 vs 2.0.0, which parse_version truncates to (2, 0) and so reads as not newer.
When
rp loginfails, the error now gives the user two concrete next steps:rp login --api-keypip install -U runpodmay fix the problemThe upgrade note only appears when the local update cache has a newer version than the installed one, so it stays silent on the common case where the user is already up to date
Follow up to #675
How I tested
uv run pytest tests/test_cli/test_management_commands.py tests/test_cli/test_agent_login.py tests/test_apps/test_auth.py tests/test_apps/test_api_client.pypasses (139 tests)