Skip to content

feat: prompt to clear contexts when switching profiles #237

Description

@aru-amedeo

Problem

acloud config profile use switches credentials but leaves all saved contexts untouched.
Contexts store project IDs that belong to a specific tenant, so after switching to a different profile (e.g. from dev to prod) the saved project IDs are almost always invalid for the new tenant. The user then hits confusing 404 / permission errors on the first resource command.

Expected behaviour

When switching profiles, the CLI should offer to clear all saved contexts, because projects belong to a single tenant (profile). The user should be able to:

  1. Accept the prompt to clear contexts in interactive mode
  2. Pass --clear-contexts to clear without a prompt in scripts/CI
  3. Decline the prompt (or run non-interactively) to keep contexts unchanged

Implemented behaviour

  • Interactive: Contexts may not be valid for the new profile. Clear all contexts? (y/N):
  • Non-interactive (piped): silently keeps contexts (safe default)
  • --clear-contexts flag: always clears, no prompt

Fixed in #236.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions