Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 1430 invoked from network); 3 Aug 2010 20:06:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Aug 2010 20:06:15 -0000 Received: (qmail 58901 invoked by uid 500); 3 Aug 2010 20:06:15 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 58875 invoked by uid 500); 3 Aug 2010 20:06:14 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 58867 invoked by uid 99); 3 Aug 2010 20:06:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Aug 2010 20:06:14 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=10.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mmorsi@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Aug 2010 20:06:06 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o73K5iYo021191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Aug 2010 16:05:44 -0400 Received: from localhost.localdomain (vpn-10-197.rdu.redhat.com [10.11.10.197]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o73K5hBd016856; Tue, 3 Aug 2010 16:05:43 -0400 Message-ID: <4C5877C9.4010903@redhat.com> Date: Tue, 03 Aug 2010 16:10:49 -0400 From: Mohammed Morsi User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.1 MIME-Version: 1.0 To: David Lutterkort CC: deltacloud-dev@incubator.apache.org Subject: Re: [PATCH] added ability to scp one or more files to a running instance References: <1280445820-3483-1-git-send-email-mmorsi@redhat.com> <1280445820-3483-3-git-send-email-mmorsi@redhat.com> <1280797376.20090.48.camel@avon.watzmann.net> In-Reply-To: <1280797376.20090.48.camel@avon.watzmann.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Virus-Checked: Checked by ClamAV on apache.org On 08/02/2010 09:02 PM, David Lutterkort wrote: > On Thu, 2010-07-29 at 19:23 -0400, Mohammed Morsi wrote: >> diff --git a/server/lib/deltacloud/models/instance.rb b/server/lib/deltacloud/models/instance.rb >> index c2c9ff4..e0cd7a6 100644 >> --- a/server/lib/deltacloud/models/instance.rb >> +++ b/server/lib/deltacloud/models/instance.rb >> @@ -17,6 +17,7 @@ >> # under the License. >> >> require 'net/ssh' >> +require 'net/scp' >> >> class Instance< BaseModel >> >> @@ -53,4 +54,15 @@ class Instance< BaseModel >> return output >> end >> >> + def copy_files(files, destination, username='', opts={}) >> + files = [files] unless files.is_a? Array >> + hostname = self.public_addresses.first >> + return "No hostname/IP address specified" unless hostname >> + Net::SCP.start(hostname, username || 'root', opts) do |session| >> + files.each { |f| >> + session.upload! f, destination >> + } >> + end >> + end > Doens't that copy all files into the same destination ? > If destination is a directory, all files will be copied there. >> + operation :copy_files, :method => :post, :member => true do >> + description "Securely copy one or more files to an instance" >> + param :id, :string, :required >> + param :files, :string, :required # FIXME should be array of strings > That explains the above - only one file per copy. Would be nice to allow > a number of files with their contents. > > David Since the core wui has jquery support I can easily add more file selection boxes. The only thing is, I'm not sure how to specify the 'files' param to this operation, as being able to accept an array of string file names (no other operation params seem to take :array as the type). Is there an easy way to do this? Or does the rabbit module need to be expanded? -Mo