Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit e8ff634

Browse files
committed
fixup! Use env.ssh_available field in config-ssh
1 parent 0c4351f commit e8ff634

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

internal/cmd/configssh.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,7 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
104104
return xerrors.New("no environments found")
105105
}
106106

107-
sshAvailable := false
108-
for _, env := range envs {
109-
if env.SSHAvailable {
110-
sshAvailable = true
111-
break
112-
}
113-
}
114-
if !sshAvailable {
107+
if !sshAvailable(envs) {
115108
return xerrors.New("SSH is disabled or not available any environments in your Coder Enterprise deployment.")
116109
}
117110

@@ -151,6 +144,17 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
151144
}
152145
}
153146

147+
// sshAvailable returns true if SSH is available for at least some environments.
148+
func sshAvailable(envs []coder.Environment) bool {
149+
for _, env := range envs {
150+
if env.SSHAvailable {
151+
return true
152+
}
153+
}
154+
155+
return false
156+
}
157+
154158
func writeSSHKey(ctx context.Context, client *coder.Client, privateKeyPath string) error {
155159
key, err := client.SSHKey(ctx)
156160
if err != nil {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy