From: efcasado <[email protected]>
---
server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 2 +-
server/lib/deltacloud/runner.rb | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 64f827c..2c86651 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -302,7 +302,7 @@ module Deltacloud
target = instance(credentials, :id => opts[:id])
param = {}
param[:credentials] = {
- :username => 'root', # Default for EC2 Linux instances
+ :username => (opts[:username]) ? opts[:username] : 'root', #
Default for EC2 Linux instances
}
param[:port] = opts[:port] || '22'
param[:ip] = opts[:ip] || target.public_addresses.first.address
diff --git a/server/lib/deltacloud/runner.rb b/server/lib/deltacloud/runner.rb
index aa13fa9..7a5d98d 100644
--- a/server/lib/deltacloud/runner.rb
+++ b/server/lib/deltacloud/runner.rb
@@ -69,6 +69,7 @@ module Deltacloud
def execute(command)
@command = command
config = ssh_config(@network, @credentials, @key)
+ username = (@credentials[:username]) ? @credentials[:username] : 'root'
begin
session = nil
# Default timeout for connecting to an instance.
@@ -77,7 +78,7 @@ module Deltacloud
# Please keep in mind that the HTTP request timeout is set to 60
# seconds, so you need to fit into this time
Timeout::timeout(20) do
- session = Net::SSH.start(@network.ip, 'root', config)
+ session = Net::SSH.start(@network.ip, username, config)
end
session.open_channel do |channel|
channel.on_data do |ch, data|
--
1.7.10.2 (Apple Git-33)