Skip to content

Commit

Permalink
no need to ssh-add forkey from ssh-agent (#2220)
Browse files Browse the repository at this point in the history
* no need to ssh-add forkey from ssh-agent

* rm unused func
fix lint
  • Loading branch information
arturrez authored Oct 7, 2024
1 parent ef5407e commit 7dff013
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions cmd/nodecmd/create_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package nodecmd
import (
"fmt"
"os"
"os/exec"
"strings"

"golang.org/x/exp/maps"
Expand Down Expand Up @@ -402,11 +401,6 @@ func createEC2Instances(ec2Svc map[string]*awsAPI.AwsCloud,
ux.Logger.GreenCheckmarkToUser("New EC2 instance(s) successfully created in AWS!")
for _, region := range regions {
if useSSHAgent {
// takes the cert file downloaded from AWS and moves it to .ssh directory
err = addCertToSSH(regionConf[region].CertName)
if err != nil {
return instanceIDs, elasticIPs, sshCertPath, keyPairName, err
}
sshCertPath[region] = ""
} else {
// don't overwrite existing sshCertPath for a particular region
Expand Down Expand Up @@ -561,17 +555,6 @@ func createAWSInstances(
return awsCloudConfig, nil
}

// addCertToSSH takes the cert file downloaded from AWS and moves it to .ssh directory
func addCertToSSH(certName string) error {
certFilePath, err := app.GetSSHCertFilePath(certName)
if err != nil {
return err
}
cmd := exec.Command("ssh-add", certFilePath)
utils.SetupRealtimeCLIOutput(cmd, true, true)
return cmd.Run()
}

// checkRegions checks if the given regions are available in AWS.
// It returns list of invalid regions and error if any
func checkRegions(regions []string) ([]string, error) {
Expand Down

0 comments on commit 7dff013

Please sign in to comment.