Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions build/ci/evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ functions:
CONFIG_PATH=$(./bin/atlas config edit 2>/dev/null)
cat <<EOF > "$CONFIG_PATH"
skip_update_check = true
telemetry_enabled = false

[__e2e]
org_id = '${atlas_org_id}'
Expand All @@ -137,7 +138,6 @@ functions:
private_api_key = '${atlas_private_api_key}'
ops_manager_url = '${mcli_ops_manager_url}'
service = 'cloud'
telemetry_enabled = false
output = 'plaintext'

[__e2e_gov]
Expand All @@ -147,7 +147,6 @@ functions:
private_api_key = '${atlas_gov_private_api_key}'
ops_manager_url = '${mcli_cloud_gov_ops_manager_url}'
service = 'cloudgov'
telemetry_enabled = false
output = 'plaintext'

[__e2e_snapshot]
Expand All @@ -157,7 +156,6 @@ functions:
private_api_key = '12345678-abcd-ef01-2345-6789abcdef01'
ops_manager_url = 'http://localhost:8080/'
service = 'cloud'
telemetry_enabled = false
output = 'plaintext'
EOF
- command: subprocess.exec
Expand Down
12 changes: 7 additions & 5 deletions internal/cli/auth/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package auth

import (
"context"
"fmt"
"io"
"net/http"
"strings"
Expand Down Expand Up @@ -154,12 +155,12 @@ func LogoutBuilder() *cobra.Command {
`,
PreRunE: func(cmd *cobra.Command, _ []string) error {
opts.OutWriter = cmd.OutOrStdout()
opts.config = config.Default()

// If the profile is set in the context, use it instead of the default profile
profile, ok := config.ProfileFromContext(cmd.Context())
if ok {
opts.config = profile
} else {
opts.config = config.Default()
}

// Only initialize OAuth flow if we have OAuth-based auth
Expand All @@ -173,13 +174,14 @@ func LogoutBuilder() *cobra.Command {
var message, entry string
var err error

fromProfile := fmt.Sprintf(" from profile %s?", opts.config.Name())
switch opts.config.AuthType() {
case config.APIKeys:
entry = opts.config.PublicAPIKey()
message = "Are you sure you want to log out of account with public API key %s?"
message = "Are you sure you want to log out of account with public API key %s" + fromProfile
case config.ServiceAccount:
entry = opts.config.ClientID()
message = "Are you sure you want to log out of service account %s?"
message = "Are you sure you want to log out of service account %s" + fromProfile
case config.UserAccount:
entry, err = opts.config.AccessTokenSubject()
if err != nil {
Expand All @@ -190,7 +192,7 @@ func LogoutBuilder() *cobra.Command {
return ErrUnauthenticated
}

message = "Are you sure you want to log out of account %s?"
message = "Are you sure you want to log out of account %s" + fromProfile
case config.NoAuth, "":
entry = opts.config.Name()
message = "Are you sure you want to clear profile %s?"
Expand Down
Loading