You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/02/08 14:20:04 UTC
git commit: Allows to specify a username when running a comman -
DTACLOUD-458
Updated Branches:
refs/heads/master 5a38b15d5 -> f67a2a7ad
Allows to specify a username when running a comman - DTACLOUD-458
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/f67a2a7a
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/f67a2a7a
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/f67a2a7a
Branch: refs/heads/master
Commit: f67a2a7ad2cfbda4353ed0dc93234383222e0c46
Parents: 5a38b15
Author: efcasado <ef...@gmail.com>
Authored: Fri Feb 8 11:47:37 2013 +0100
Committer: Michal fojtik <mf...@redhat.com>
Committed: Fri Feb 8 14:19:47 2013 +0100
----------------------------------------------------------------------
server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 2 +-
server/lib/deltacloud/runner.rb | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f67a2a7a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
----------------------------------------------------------------------
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
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f67a2a7a/server/lib/deltacloud/runner.rb
----------------------------------------------------------------------
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|