Skip to content

Commit

Permalink
unable to run cli, package issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jarededwards committed Mar 4, 2024
1 parent f2a3fac commit 38307bf
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 123 deletions.
34 changes: 16 additions & 18 deletions cmd/akamai/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import (
"github.com/kubefirst/kubefirst/internal/provision"
"github.com/kubefirst/kubefirst/internal/utilities"
"github.com/kubefirst/runtime/pkg"
internalssh "github.com/kubefirst/runtime/pkg/ssh"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -107,22 +105,22 @@ func ValidateProvidedFlags(gitProvider string) error {
}
}

switch gitProvider {
case "github":
key, err := internalssh.GetHostKey("github.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "github.com", key.Type())
}
case "gitlab":
key, err := internalssh.GetHostKey("gitlab.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
}
}
// switch gitProvider {
// case "github":
// key, err := internalssh.GetHostKey("github.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "github.com", key.Type())
// }
// case "gitlab":
// key, err := internalssh.GetHostKey("gitlab.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
// }
// }

progress.CompleteStep("Validate provided flags")

Expand Down
35 changes: 16 additions & 19 deletions cmd/digitalocean/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"fmt"
"os"

"github.com/rs/zerolog/log"

"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
Expand All @@ -20,7 +18,6 @@ import (
"github.com/kubefirst/kubefirst/internal/provision"
"github.com/kubefirst/kubefirst/internal/utilities"
"github.com/kubefirst/runtime/pkg"
internalssh "github.com/kubefirst/runtime/pkg/ssh"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -116,22 +113,22 @@ func ValidateProvidedFlags(gitProvider string) error {
}
}

switch gitProvider {
case "github":
key, err := internalssh.GetHostKey("github.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "github.com", key.Type())
}
case "gitlab":
key, err := internalssh.GetHostKey("gitlab.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
}
}
// switch gitProvider {
// case "github":
// key, err := internalssh.GetHostKey("github.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "github.com", key.Type())
// }
// case "gitlab":
// key, err := internalssh.GetHostKey("gitlab.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
// }
// }

progress.CompleteStep("Validate provided flags")

Expand Down
35 changes: 16 additions & 19 deletions cmd/google/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"fmt"
"os"

"github.com/rs/zerolog/log"

"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
Expand All @@ -20,7 +18,6 @@ import (
"github.com/kubefirst/kubefirst/internal/provision"
"github.com/kubefirst/kubefirst/internal/utilities"
"github.com/kubefirst/runtime/pkg"
internalssh "github.com/kubefirst/runtime/pkg/ssh"
"github.com/spf13/cobra"
"github.com/spf13/viper"
_ "k8s.io/client-go/plugin/pkg/client/auth"
Expand Down Expand Up @@ -110,22 +107,22 @@ func ValidateProvidedFlags(gitProvider string) error {
progress.Error("Unable to read GOOGLE_APPLICATION_CREDENTIALS file")
}

switch gitProvider {
case "github":
key, err := internalssh.GetHostKey("github.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "github.com", key.Type())
}
case "gitlab":
key, err := internalssh.GetHostKey("gitlab.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
}
}
// switch gitProvider {
// case "github":
// key, err := internalssh.GetHostKey("github.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "github.com", key.Type())
// }
// case "gitlab":
// key, err := internalssh.GetHostKey("gitlab.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
// }
// }

progress.CompleteStep("Validate provided flags")

Expand Down
59 changes: 29 additions & 30 deletions cmd/k3d/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"github.com/kubefirst/runtime/pkg/k8s"
"github.com/kubefirst/runtime/pkg/progressPrinter"
"github.com/kubefirst/runtime/pkg/services"
internalssh "github.com/kubefirst/runtime/pkg/ssh"
"github.com/kubefirst/runtime/pkg/terraform"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
Expand Down Expand Up @@ -130,22 +129,22 @@ func runK3d(cmd *cobra.Command, args []string) error {
return err
}

switch gitProviderFlag {
case "github":
key, err := internalssh.GetHostKey("github.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "github.com", key.Type())
}
case "gitlab":
key, err := internalssh.GetHostKey("gitlab.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
}
}
// switch gitProviderFlag {
// case "github":
// key, err := internalssh.GetHostKey("github.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "github.com", key.Type())
// }
// case "gitlab":
// key, err := internalssh.GetHostKey("gitlab.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
// }
// }

// Either user or org can be specified for github, not both
if githubOrgFlag != "" && githubUserFlag != "" {
Expand Down Expand Up @@ -450,11 +449,11 @@ func runK3d(cmd *cobra.Command, args []string) error {
telemetry.SendEvent(segClient, telemetry.KbotSetupStarted, "")

log.Info().Msg("creating an ssh key pair for your new cloud infrastructure")
sshPrivateKey, sshPublicKey, err = internalssh.CreateSshKeyPair()
if err != nil {
telemetry.SendEvent(segClient, telemetry.KbotSetupFailed, err.Error())
return err
}
// sshPrivateKey, sshPublicKey, err = internalssh.CreateSshKeyPair()
// if err != nil {
// telemetry.SendEvent(segClient, telemetry.KbotSetupFailed, err.Error())
// return err
// }
log.Info().Msg("ssh key pair creation complete")

viper.Set("kbot.private-key", sshPrivateKey)
Expand Down Expand Up @@ -702,14 +701,14 @@ func runK3d(cmd *cobra.Command, args []string) error {
log.Info().Msgf("error opening repo at: %s", config.MetaphorDir)
}

err = internalssh.EvalSSHKey(&internalssh.EvalSSHKeyRequest{
GitProvider: gitProviderFlag,
GitlabGroupFlag: gitlabGroupFlag,
GitToken: cGitToken,
})
if err != nil {
return err
}
// err = internalssh.EvalSSHKey(&internalssh.EvalSSHKeyRequest{
// GitProvider: gitProviderFlag,
// GitlabGroupFlag: gitlabGroupFlag,
// GitToken: cGitToken,
// })
// if err != nil {
// return err
// }

//Push to remotes and use https
// Push gitops repo to remote
Expand Down
34 changes: 16 additions & 18 deletions cmd/vultr/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"github.com/kubefirst/kubefirst/internal/provision"
"github.com/kubefirst/kubefirst/internal/utilities"
"github.com/kubefirst/runtime/pkg"
internalssh "github.com/kubefirst/runtime/pkg/ssh"
"github.com/rs/zerolog/log"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -114,22 +112,22 @@ func ValidateProvidedFlags(gitProvider string) error {
}
}

switch gitProvider {
case "github":
key, err := internalssh.GetHostKey("github.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "github.com", key.Type())
}
case "gitlab":
key, err := internalssh.GetHostKey("gitlab.com")
if err != nil {
return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
} else {
log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
}
}
// switch gitProvider {
// case "github":
// key, err := internalssh.GetHostKey("github.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "github.com", key.Type())
// }
// case "gitlab":
// key, err := internalssh.GetHostKey("gitlab.com")
// if err != nil {
// return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy")
// } else {
// log.Info().Msgf("%s %s\n", "gitlab.com", key.Type())
// }
// }

progress.CompleteStep("Validate provided flags")

Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ require (
github.com/yuin/goldmark-emoji v1.0.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
Expand Down Expand Up @@ -221,7 +221,7 @@ require (
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-github/v52 v52.0.0
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand Down Expand Up @@ -264,11 +264,11 @@ require (
github.com/spf13/pflag v1.0.5
github.com/subosito/gotenv v1.4.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
Expand Down
Loading

0 comments on commit 38307bf

Please sign in to comment.