Skip to content

Commit

Permalink
include file in name
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsullivan committed Oct 26, 2020
1 parent 2db7e06 commit 8f53d1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion examples/plans/ssh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions instance/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8f53d1c

Please sign in to comment.