Skip to content

Commit 7dea772

Browse files
craig[bot]herkolategan
andcommitted
107536: roachprod: Azure FindActiveAccount username fix r=renatolabs a=herkolategan This change fixes an issue where FindActiveAccount expects an email based username. It can now handle usernames that are not in email form. Fixes: cockroachdb#107535 Release Note: None Epic: none Co-authored-by: Herko Lategan <[email protected]>
2 parents b0a4853 + a3089cd commit 7dea772

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/roachprod/vm/azure/azure.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,9 @@ func (p *Provider) FindActiveAccount(l *logger.Logger) (string, error) {
432432
return "", errors.Wrapf(err, "could not decode JWT claims segment")
433433
}
434434

435-
// This is in an email address format, we just want the username.
436-
return data.Username[:strings.Index(data.Username, "@")], nil
435+
// If this is in an email address format, we just want the username.
436+
username, _, _ := strings.Cut(data.Username, "@")
437+
return username, nil
437438
}
438439

439440
// List implements the vm.Provider interface. This will query all

0 commit comments

Comments
 (0)