Skip to content

Commit

Permalink
Merge pull request #23 from blom/patch-6
Browse files Browse the repository at this point in the history
Add an ssh_user option to the ssh command
  • Loading branch information
pearkes committed May 1, 2013
2 parents ae8a498 + dac9021 commit cf17c6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/tugboat/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ def images
:type => :string,
:aliases => "-p",
:desc => "The custom SSH Port to connect to"
method_option "ssh_user",
:type => :string,
:aliases => "-u",
:desc => "Specifies which user to log in as"
def ssh(name=nil)
Middleware.sequence_ssh_droplet.call({
"user_droplet_id" => options[:id],
"user_droplet_name" => options[:name],
"user_droplet_fuzzy_name" => name,
"user_droplet_ssh_port" => options[:ssh_port]
"user_droplet_ssh_port" => options[:ssh_port],
"user_droplet_ssh_user" => options[:ssh_user]
})
end

Expand Down
3 changes: 2 additions & 1 deletion lib/tugboat/middleware/ssh_droplet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def call(env)
options.push("-p", "22")
end

host_string = "#{env["config"].ssh_user}@#{env["droplet_ip"]}"
ssh_user = env["user_droplet_ssh_user"] || env["config"].ssh_user
host_string = "#{ssh_user}@#{env["droplet_ip"]}"

options << host_string

Expand Down

0 comments on commit cf17c6b

Please sign in to comment.