deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject git commit: Allows to specify a username when running a comman - DTACLOUD-458
Date Fri, 08 Feb 2013 13:20:04 GMT
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 <efcasado@gmail.com>
Authored: Fri Feb 8 11:47:37 2013 +0100
Committer: Michal fojtik <mfojtik@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|


Mime
View raw message