Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept ACS token passed in env to auth login #1550

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Fixes

* Accepts `DCOS_CLUSTER_SETUP_ACS_TOKEN` in `dcos auth login` (#1550)
* Read auth token without echoing it (#1551)
* Overcome Windows 254 characters limit on Windows (#1551)

Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/auth/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ func newCmdAuthLogin(ctx api.Context) *cobra.Command {
if err != nil {
return err
}
acsToken, err := ctx.Login(flags, httpClient)
if err != nil {
return err
// Login to get the ACS token, unless it is already present as an env var.
acsToken, _ := ctx.EnvLookup("DCOS_CLUSTER_SETUP_ACS_TOKEN")
if acsToken == "" {
pierrebeitz marked this conversation as resolved.
Show resolved Hide resolved
acsToken, err = ctx.Login(flags, httpClient)
if err != nil {
return err
}
}
cluster.SetACSToken(acsToken)
err = cluster.Config().Persist()
Expand Down