cli, etcd, lib: Fixup golint issues with SSH

This stuff is arbitrary and stupid.
This commit is contained in:
James Shubin
2025-04-05 12:44:56 -04:00
parent f6a8404f9f
commit fce250b8af
3 changed files with 16 additions and 16 deletions

View File

@@ -54,14 +54,14 @@ import (
// particular one contains all the common flags for the `deploy` subcommand // particular one contains all the common flags for the `deploy` subcommand
// which all frontends can use. // which all frontends can use.
type DeployArgs struct { type DeployArgs struct {
// SshUrl can be specified if we want to transport the SSH client // SSHURL can be specified if we want to transport the SSH client
// connection over SSH. If this is specified, the second hop is made // connection over SSH. If this is specified, the second hop is made
// with the Seeds values, but they connect from this destination. You // with the Seeds values, but they connect from this destination. You
// can specify this in the standard james@server:22 format. This will // can specify this in the standard james@server:22 format. This will
// use your ~/.ssh/ directory for public key authentication and // use your ~/.ssh/ directory for public key authentication and
// verifying the host key in the known_hosts file. This must already be // verifying the host key in the known_hosts file. This must already be
// setup for things to work. // setup for things to work.
SshUrl string `arg:"--ssh-url" help:"transport the etcd client connection over SSH to this server"` SSHURL string `arg:"--ssh-url" help:"transport the etcd client connection over SSH to this server"`
Seeds []string `arg:"--seeds,env:MGMT_SEEDS" help:"default etcd client endpoints"` Seeds []string `arg:"--seeds,env:MGMT_SEEDS" help:"default etcd client endpoints"`
Noop bool `arg:"--noop" help:"globally force all resources into no-op mode"` Noop bool `arg:"--noop" help:"globally force all resources into no-op mode"`
@@ -208,9 +208,9 @@ func (obj *DeployArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error
//GetURI: func() string { //GetURI: func() string {
//}, //},
} }
if obj.SshUrl != "" { // alternate world implementation over SSH if obj.SSHURL != "" { // alternate world implementation over SSH
world = &etcdSSH.World{ world = &etcdSSH.World{
URL: obj.SshUrl, URL: obj.SSHURL,
Seeds: obj.Seeds, Seeds: obj.Seeds,
NS: lib.NS, NS: lib.NS,
//MetadataPrefix: lib.MetadataPrefix, //MetadataPrefix: lib.MetadataPrefix,

View File

@@ -54,7 +54,7 @@ import (
const ( const (
defaultUser = "root" defaultUser = "root"
defaultSshPort uint16 = 22 defaultSSHPort uint16 = 22
defaultEtcdPort uint16 = 2379 // TODO: get this from etcd pkg defaultEtcdPort uint16 = 2379 // TODO: get this from etcd pkg
defaultIDRsaPath = "~/.ssh/id_rsa" defaultIDRsaPath = "~/.ssh/id_rsa"
defaultIDEd25519Path = "~/.ssh/id_ed25519" defaultIDEd25519Path = "~/.ssh/id_ed25519"
@@ -68,12 +68,12 @@ type World struct {
// ip's should be relative to this server. // ip's should be relative to this server.
URL string URL string
// SshID is the path to the ~/.ssh/id_rsa or ~/.ssh/id_ed25519 to use // SSHID is the path to the ~/.ssh/id_rsa or ~/.ssh/id_ed25519 to use
// for auth. If you omit this then this will look for your private key // for auth. If you omit this then this will look for your private key
// in both of those default paths. If you specific a specific path, then // in both of those default paths. If you specific a specific path, then
// that will only be used. This will expand the ~/ and ~user/ style path // that will only be used. This will expand the ~/ and ~user/ style path
// expansions. // expansions.
SshID string SSHID string
// Seeds are the list of etcd endpoints to connect to. // Seeds are the list of etcd endpoints to connect to.
Seeds []string Seeds []string
@@ -161,7 +161,7 @@ func (obj *World) Init(init *engine.WorldInit) error {
if hostname == "" { if hostname == "" {
return fmt.Errorf("empty hostname") return fmt.Errorf("empty hostname")
} }
port := strconv.Itoa(int(defaultSshPort)) // default port := strconv.Itoa(int(defaultSSHPort)) // default
if s := u.Port(); s != "" { if s := u.Port(); s != "" {
port = s port = s
} }
@@ -193,7 +193,7 @@ func (obj *World) Init(init *engine.WorldInit) error {
if hostname == "" { if hostname == "" {
return fmt.Errorf("empty hostname") return fmt.Errorf("empty hostname")
} }
port := strconv.Itoa(int(defaultSshPort)) // default port := strconv.Itoa(int(defaultSSHPort)) // default
if s := u.Port(); s != "" { if s := u.Port(); s != "" {
port = s port = s
} }
@@ -203,13 +203,13 @@ func (obj *World) Init(init *engine.WorldInit) error {
auths := []ssh.AuthMethod{} auths := []ssh.AuthMethod{}
//auths = append(auths, ssh.Password("password")) // testing //auths = append(auths, ssh.Password("password")) // testing
choices := []string{ choices := []string{
//obj.SshID, //obj.SSHID,
defaultIDEd25519Path, defaultIDEd25519Path,
defaultIDRsaPath, // "~/.ssh/id_rsa" defaultIDRsaPath, // "~/.ssh/id_rsa"
} }
if obj.SshID != "" { if obj.SSHID != "" {
choices = []string{ choices = []string{
obj.SshID, obj.SSHID,
} }
} }
for _, p := range choices { for _, p := range choices {

View File

@@ -148,14 +148,14 @@ type Config struct {
// this many seconds. Use 0 to disable this. // this many seconds. Use 0 to disable this.
MaxRuntime uint `arg:"--max-runtime,env:MGMT_MAX_RUNTIME" help:"exit after a maximum of approximately this many seconds"` MaxRuntime uint `arg:"--max-runtime,env:MGMT_MAX_RUNTIME" help:"exit after a maximum of approximately this many seconds"`
// SshUrl can be specified if we want to transport the SSH client // SSHURL can be specified if we want to transport the SSH client
// connection over SSH. If this is specified, the second hop is made // connection over SSH. If this is specified, the second hop is made
// with the Seeds values, but they connect from this destination. You // with the Seeds values, but they connect from this destination. You
// can specify this in the standard james@server:22 format. This will // can specify this in the standard james@server:22 format. This will
// use your ~/.ssh/ directory for public key authentication and // use your ~/.ssh/ directory for public key authentication and
// verifying the host key in the known_hosts file. This must already be // verifying the host key in the known_hosts file. This must already be
// setup for things to work. // setup for things to work.
SshUrl string `arg:"--ssh-url" help:"transport the etcd client connection over SSH to this server"` SSHURL string `arg:"--ssh-url" help:"transport the etcd client connection over SSH to this server"`
// Seeds are the list of default etcd client endpoints. If empty, it // Seeds are the list of default etcd client endpoints. If empty, it
// will startup a new server. // will startup a new server.
@@ -617,9 +617,9 @@ func (obj *Main) Run() error {
return gapiInfoResult.URI return gapiInfoResult.URI
}, },
} }
if obj.SshUrl != "" { // alternate world implementation over SSH if obj.SSHURL != "" { // alternate world implementation over SSH
world = &etcdSSH.World{ world = &etcdSSH.World{
URL: obj.SshUrl, URL: obj.SSHURL,
Seeds: obj.Seeds, Seeds: obj.Seeds,
NS: NS, NS: NS,
MetadataPrefix: MetadataPrefix, MetadataPrefix: MetadataPrefix,