diff --git a/oks_cli/cluster.py b/oks_cli/cluster.py index dd4e1f2..600a8bf 100644 --- a/oks_cli/cluster.py +++ b/oks_cli/cluster.py @@ -74,6 +74,13 @@ def cluster_logout(ctx, profile): """Clear the current default cluster selection.""" _, _, profile = ctx_update(ctx, None, None, profile) login_profile(profile) + + current_cluster = get_cluster_id() + + if not current_cluster: + click.echo("You are not connected to any cluster.") + return + set_cluster_id("") click.echo("Logged out from the current cluster") diff --git a/oks_cli/project.py b/oks_cli/project.py index 5e95d44..9b0ebcc 100644 --- a/oks_cli/project.py +++ b/oks_cli/project.py @@ -56,6 +56,13 @@ def project_logout(ctx, profile): """Unset the current default project and log out.""" _, _, profile = ctx_update(ctx, None, None, profile) login_profile(profile) + + current_project = get_project_id() + + if not current_project: + click.echo("You are not connected to any project.") + return + set_project_id("") set_cluster_id("") click.echo("Logged out from the current project")