From 8f53d1c1a60a238ab559b3cda729b7dbbba9fb54 Mon Sep 17 00:00:00 2001 From: Scott Sullivan Date: Mon, 26 Oct 2020 13:33:26 -0400 Subject: [PATCH] include file in name --- cmd/ssh.go | 8 ++++---- examples/plans/ssh.yaml | 2 +- instance/ssh.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/ssh.go b/cmd/ssh.go index 014cd73..1957e35 100644 --- a/cmd/ssh.go +++ b/cmd/ssh.go @@ -38,7 +38,7 @@ Examples: - lw ssh --host ABC123 * SSH by uniq-id making use of all flags: -- lw ssh --host ABC123 --agent-forwarding --port 2222 --private-ssh-key /home/myself/.ssh-alt/id_rsa \ +- lw ssh --host ABC123 --agent-forwarding --port 2222 --private-key-file /home/myself/.ssh-alt/id_rsa \ --user amanda --command "ps faux && free -m" Plan Examples: @@ -48,7 +48,7 @@ ssh: - host: nd00.ltv1wv76kc.io command: "free -m" user: "root" - private-key: "/home/myself/.ssh/id_rsa" + private-key-file: "/home/myself/.ssh/id_rsa" agent-forwarding: true port: 22 - host: PPB4NZ @@ -60,7 +60,7 @@ lw plan --file /tmp/ssh.yaml params := &instance.SshParams{} params.Host, _ = cmd.Flags().GetString("host") - params.PrivateKey, _ = cmd.Flags().GetString("private-ssh-key") + params.PrivateKeyFile, _ = cmd.Flags().GetString("private-key-file") params.User, _ = cmd.Flags().GetString("user") params.AgentForwarding, _ = cmd.Flags().GetBool("agent-forwarding") params.Port, _ = cmd.Flags().GetInt("port") @@ -77,7 +77,7 @@ func init() { sshCmd.Flags().String("host", "", "uniq-id or hostname for the Server") sshCmd.Flags().Int("port", 22, "ssh port to use") - sshCmd.Flags().String("private-ssh-key", "", "path to a specific/non default ssh private key to use") + sshCmd.Flags().String("private-key-file", "", "path to a specific/non default ssh private key to use") sshCmd.Flags().Bool("agent-forwarding", false, "whether or not to enable ssh agent forwarding") sshCmd.Flags().String("user", "root", "username to use for the ssh connection") sshCmd.Flags().String("command", "", "run this command and exit rather than start an interactive shell") diff --git a/examples/plans/ssh.yaml b/examples/plans/ssh.yaml index e1f93c8..66e2d51 100644 --- a/examples/plans/ssh.yaml +++ b/examples/plans/ssh.yaml @@ -3,7 +3,7 @@ ssh: - host: nd00.ltv1wv76kc.io command: "free -m" user: "root" - private-key: "/home/myself/.ssh/id_rsa" + private-key-file: "/home/myself/.ssh/id_rsa" agent-forwarding: true port: 22 - host: PPB4NZ diff --git a/instance/ssh.go b/instance/ssh.go index 18fafc3..9b86af8 100644 --- a/instance/ssh.go +++ b/instance/ssh.go @@ -27,7 +27,7 @@ import ( type SshParams struct { Host string `yaml:"host"` Port int `yaml:"port"` - PrivateKey string `yaml:"private-key"` + PrivateKeyFile string `yaml:"private-key-file"` User string `yaml:"user"` AgentForwarding bool `yaml:"agent-forwarding"` Command string `yaml:"command"` @@ -108,8 +108,8 @@ func (self *Client) Ssh(params *SshParams) (err error) { } sshArgs := []string{} - if params.PrivateKey != "" { - sshArgs = append(sshArgs, "-i", params.PrivateKey) + if params.PrivateKeyFile != "" { + sshArgs = append(sshArgs, "-i", params.PrivateKeyFile) } if params.AgentForwarding {