Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4B4AD44E for ; Fri, 8 Feb 2013 13:20:07 +0000 (UTC) Received: (qmail 98734 invoked by uid 500); 8 Feb 2013 13:20:07 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 98670 invoked by uid 500); 8 Feb 2013 13:20:05 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 98618 invoked by uid 99); 8 Feb 2013 13:20:04 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Feb 2013 13:20:04 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 13B133A55F; Fri, 8 Feb 2013 13:20:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mfojtik@apache.org To: commits@deltacloud.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: Allows to specify a username when running a comman - DTACLOUD-458 Message-Id: <20130208132004.13B133A55F@tyr.zones.apache.org> Date: Fri, 8 Feb 2013 13:20:04 +0000 (UTC) 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 Authored: Fri Feb 8 11:47:37 2013 +0100 Committer: Michal fojtik 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|