Bug #213

EC2 multipart upload installation issue

Added by Gyula Csom about 11 years ago. Updated almost 11 years ago.

Status:ClosedStart date:04/17/2010
Priority:NormalDue date:
Assignee:Daniel Molina% Done:

100%

Category:-
Target version:Release 2.0
Resolution: Pull request:
Affected Versions:

Description

Hi there,
while testing the EC2 interface I've ran into the following problem.

After a fresh EC2 (dependency) install the multipart-post doesn't work (on Ubuntu). This seems to be an
installation issue: multipart-post must be separately installed.

Problem

The OCCI userguide mentions that on some platform Curl is buggy, therefore one should use the
multiplart upload (built into Ruby). However, after a fresh install multipart upload doesn't work,
gives back the following error:

$ econe-upload -M ttylinux.img   
/opt/one/lib/ruby/cloud/econe/EC2QueryClient.rb:173:in `upload_image`  Unitialized constant EC2QueryClient::UploadIO (NameError)  
    from /opt/one/bin/econe-upload:115

Investigation

Though I have no experience in Ruby programming I did some investigation:

econe-upload:115:  
108: ec2_client = EC2QueryClient::Client.new(auth,url)  
…  
114: rc = ec2_client.upload_image(image, curb)  
115:  

EC2QueryClient.rb:173:  
25: require 'CloudClient'  
26: require 'AWS'  
…  
150: if curb and CURL_LOADED  
…  
168: else  
…  
172:     params["file"]=UploadIO.new(file,  
173:        'application/octet-stream', file_name)  
174:  
175:     req = Net::HTTP::Post::Multipart.new('/', params)  

As far as I see upload_image() tries to set the POST parameter named 'file', however the system cannot resolve the
UploadIO symbol. I did some further investigation eg. checked requires within CloudClient:

CloudClient.rb:  
30: begin  
31:    require 'net/http/post/multipart'  
32: rescue LoadError  
33: end  

It seems that the above net/http/post/multipart handles multipart posts. The multipart-post documentation seems to
confirm this: „Provides an UploadIO helper module to prepare IO objects for inclusion in the params hash of the
multipart post object.” (http://github.com/nicksieger/multipart-post)

Solution

$ sudo gem install multipart-post

and now multipart upload works:

$ econe-upload -M ttylinux.img  
Success: ImageId 4  

Testing environment

  • Ubuntu 9.10 server i386 (Linux 2.6.31)
  • Ruby v. 1.8

Cheers,
Gyula

Associated revisions

Revision 4f2a7cd8
Added by Ruben S. Montero almost 11 years ago

bug #213: Check if multipart post gem is loaded

Revision 238bf6da
Added by Abel Coronado over 4 years ago

Vm group (#213)

  • Little change in style in role datatable
  • Restyled labels in role-tab

History

#1 Updated by Gyula Csom about 11 years ago

Of course the above is not a software bug, just a documentation issue. However I haven't found other issue type to put it under...

#2 Updated by Gyula Csom about 11 years ago

The client would might be more robust if it detected the loaded libraries.
Something like this:

CloudClient.rb:  
30: begin  
31:    require 'net/http/post/multipart'  
32:    MULTIPART_POST_LOADED = true
33: rescue LoadError  
34:    MULTIPART_POST_LOADED = false
35: end  

econe-upload:  
114: raise LoadError, "either Curl/Curb or multipart-post must be installed" if (curb && !CURL_LOADED && !MULTIPART_POST_LOADED)
115: raise LoadError, "multipart-post must be installed" if (!curb && !MULTIPART_POST_LOADED)
116: rc = ec2_client.upload_image(image, curb)

#3 Updated by Ruben S. Montero about 11 years ago

  • Assignee set to Javi Fontan
  • Target version set to Release 1.4.2

Thanks for the mixing pieces in the documentation. I think that we could also add the code to check the libraries in the client side, thanks for the patch!.

#4 Updated by Ruben S. Montero about 11 years ago

  • Status changed from New to Assigned

#5 Updated by Ruben S. Montero about 11 years ago

  • Target version changed from Release 1.4.2 to Release 2.0

#6 Updated by Ruben S. Montero almost 11 years ago

  • Assignee changed from Javi Fontan to Daniel Molina

#7 Updated by Daniel Molina almost 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF