Skip to content

Commit 88e562a

Browse files
authored
fix: logout and minor improvements (#4177)
1 parent fc30767 commit 88e562a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

build/ci/evergreen.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ functions:
129129
CONFIG_PATH=$(./bin/atlas config edit 2>/dev/null)
130130
cat <<EOF > "$CONFIG_PATH"
131131
skip_update_check = true
132+
telemetry_enabled = false
132133
133134
[__e2e]
134135
org_id = '${atlas_org_id}'
@@ -137,7 +138,6 @@ functions:
137138
private_api_key = '${atlas_private_api_key}'
138139
ops_manager_url = '${mcli_ops_manager_url}'
139140
service = 'cloud'
140-
telemetry_enabled = false
141141
output = 'plaintext'
142142
143143
[__e2e_gov]
@@ -147,7 +147,6 @@ functions:
147147
private_api_key = '${atlas_gov_private_api_key}'
148148
ops_manager_url = '${mcli_cloud_gov_ops_manager_url}'
149149
service = 'cloudgov'
150-
telemetry_enabled = false
151150
output = 'plaintext'
152151
153152
[__e2e_snapshot]
@@ -157,7 +156,6 @@ functions:
157156
private_api_key = '12345678-abcd-ef01-2345-6789abcdef01'
158157
ops_manager_url = 'http://localhost:8080/'
159158
service = 'cloud'
160-
telemetry_enabled = false
161159
output = 'plaintext'
162160
EOF
163161
- command: subprocess.exec

internal/cli/auth/logout.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ func LogoutBuilder() *cobra.Command {
154154
`,
155155
PreRunE: func(cmd *cobra.Command, _ []string) error {
156156
opts.OutWriter = cmd.OutOrStdout()
157-
opts.config = config.Default()
158-
159157
// If the profile is set in the context, use it instead of the default profile
160158
profile, ok := config.ProfileFromContext(cmd.Context())
161159
if ok {
162160
opts.config = profile
161+
} else {
162+
opts.config = config.Default()
163163
}
164164

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

176+
logoutMessage := "Are you sure you want to log out of profile " + opts.config.Name()
176177
switch opts.config.AuthType() {
177178
case config.APIKeys:
178179
entry = opts.config.PublicAPIKey()
179-
message = "Are you sure you want to log out of account with public API key %s?"
180+
message = logoutMessage + " with public API key %s?"
180181
case config.ServiceAccount:
181182
entry = opts.config.ClientID()
182-
message = "Are you sure you want to log out of service account %s?"
183+
message = logoutMessage + " with service account %s?"
183184
case config.UserAccount:
184185
entry, err = opts.config.AccessTokenSubject()
185186
if err != nil {
@@ -190,10 +191,10 @@ func LogoutBuilder() *cobra.Command {
190191
return ErrUnauthenticated
191192
}
192193

193-
message = "Are you sure you want to log out of account %s?"
194+
message = logoutMessage + " with user account %s?"
194195
case config.NoAuth, "":
195196
entry = opts.config.Name()
196-
message = "Are you sure you want to clear profile %s?"
197+
message = logoutMessage + "?"
197198
}
198199

199200
opts.Entry = entry

0 commit comments

Comments
 (0)