Skip to content

Commit

Permalink
Fix Servers#add_host port handling
Browse files Browse the repository at this point in the history
See previous commit for details.
  • Loading branch information
dbenamydd committed Feb 12, 2017
1 parent aa13725 commit 5aea6dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/capistrano/configuration/servers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Servers

def add_host(host, properties={})
new_host = Server[host]
new_host.port = properties[:port] if properties.key?(:port)
if (server = servers.find { |s| s.matches? new_host })
server.user = new_host.user if new_host.user
server.with(properties)
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/capistrano/configuration/servers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Configuration
servers.add_host("1", roles: [:app, "web"], test: :value, user: "root", port: 34)
servers.add_host("1", roles: [:app, "web"], test: :value, user: "deployer", port: 34)
servers.add_host("1", roles: [:app, "web"], test: :value, user: "deployer", port: 56)
expect(servers.count).to eq(5)
expect(servers.count).to eq(4)
end

describe "with a :user property" do
Expand Down

0 comments on commit 5aea6dc

Please sign in to comment.