Conversation
WalkthroughThis change introduces a unified mechanism for handling token expiration and automatic OIDC re-authentication across CLI commands. It adds a decorator that detects expired tokens, triggers re-authentication using a new Changes
Sequence Diagram(s)sequenceDiagram
participant CLI_Command
participant Decorator
participant ClientConfig
participant relogin_client
participant OIDC_Provider
CLI_Command->>Decorator: Execute command (e.g., get_leases)
Decorator->>ClientConfig: Call async method (e.g., list_leases)
ClientConfig-->>Decorator: Raises ConnectionError (token expired)
Decorator->>relogin_client: relogin_client(config)
relogin_client->>OIDC_Provider: Perform OIDC re-authentication
OIDC_Provider-->>relogin_client: Return new tokens
relogin_client->>ClientConfig: Update config with new token
Decorator->>CLI_Command: Raise ClickExceptionRed (prompt user to retry)
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧬 Code Graph Analysis (2)packages/jumpstarter-cli/jumpstarter_cli/shell.py (2)
packages/jumpstarter-cli/jumpstarter_cli/login.py (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
🔇 Additional comments (7)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
12d61a8 to
4929415
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/jumpstarter-cli-common/jumpstarter_cli_common/exceptions.py(2 hunks)packages/jumpstarter-cli/jumpstarter_cli/config_client.py(5 hunks)packages/jumpstarter-cli/jumpstarter_cli/get.py(3 hunks)packages/jumpstarter-cli/jumpstarter_cli/login.py(3 hunks)packages/jumpstarter/jumpstarter/common/exceptions.py(1 hunks)packages/jumpstarter/jumpstarter/config/client.py(8 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/jumpstarter-cli/jumpstarter_cli/get.py
- packages/jumpstarter/jumpstarter/common/exceptions.py
- packages/jumpstarter-cli/jumpstarter_cli/config_client.py
- packages/jumpstarter/jumpstarter/config/client.py
🧰 Additional context used
🪛 GitHub Check: ruff
packages/jumpstarter-cli/jumpstarter_cli/login.py
[failure] 141-141: Ruff (W292)
packages/jumpstarter-cli/jumpstarter_cli/login.py:141:74: W292 No newline at end of file
🪛 GitHub Actions: Lint
packages/jumpstarter-cli/jumpstarter_cli/login.py
[warning] 141-141: Ruff: No newline at end of file (W292)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: e2e
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
🔇 Additional comments (2)
packages/jumpstarter-cli-common/jumpstarter_cli_common/exceptions.py (1)
7-7: LGTM: Import addition supports new exception handling.The addition of
ConnectionErrorto the imports is necessary for the new token expiration handling logic.packages/jumpstarter-cli/jumpstarter_cli/login.py (1)
53-132: LGTM: Login function refactoring maintains functionality.The refactoring to use
config_kindvariable improves code organization and readability while maintaining the same functionality. The logic flow remains correct.
|
what am i doing wrong when i see: when trying jmp login --insecure-tls-config |
Thanks, let me check ... probably what am I doing wrong here :D ... |
I tested and it should work now with the latest change. We have some E2E testing for this, but it doesn't cover the interactive part because it's a bit hard to do. https://github.com/jumpstarter-dev/jumpstarter-e2e/blob/main/tests.bats#L40 I think I can at least add the flag to be tested at some point too |
|
ha, I broke more stuff... fixing, |
* A token expired exception triggers re-login * re-login works
Fixes: #539
Fixes: #538
Summary by CodeRabbit
New Features
Bug Fixes