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 ?
> + 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