[one-users] Sunstone image upload not working - images not in tmpdir

Stefan Kooman stefan at bit.nl
Fri Nov 29 00:27:51 PST 2013


Quoting Daniel Molina (dmolina at opennebula.org):
> On 28 November 2013 18:15, Stefan Kooman <stefan at bit.nl> wrote:
> 
> > Quoting Daniel Molina (dmolina at opennebula.org):
> > > On 27 November 2013 21:27, Stefan Kooman <stefan at bit.nl> wrote:
> > >
> > >
> > > We didn't change anything, just:
> > >
> > https://github.com/OpenNebula/one/commit/f8e2e65b0170268e9c72d52c4fe9f0e13fa05acd
> > >
> > > So, it should work as before.
> >
> > Passenger 4.0.26 is giving me this error (500):
> >
> > [ 2013-11-28 17:34:07.3852 19823/7f177e5a6700
> > Pool2/Implementation.cpp:1291 ]: [App 19906 stderr] NameError -
> > uninitialized constant PhusionPassenger::Utils::RewindableInput:
> > [ 2013-11-28 17:34:07.3858 19823/7f177e5a6700
> > Pool2/Implementation.cpp:1291 ]: [App 19906 stderr]
> > /usr/lib/one/sunstone/sunstone-server.rb:412:in `block in <top (required)>'
> >
> > Image upload _is_ working with Apache Passenger 3.0.13debian-1.2.
> > Apparently
> > passenger 4.x needs this class to be handled differently.
> >
> 
> Could you check what it the value of rackinput.class in the "post '/upload'
> do" method of sunstone-server.rb. You can add a
> logger.error(rackinput.class) and it will be reported in the log.

##############################################################################
# Upload image
##############################################################################
post '/upload'do

    tmpfile = nil
    rackinput = request.env['rack.input']

    if (rackinput.class == Tempfile)
        tmpfile = rackinput
    elsif (rackinput.class == StringIO || rackinput.class == PhusionPassenger::Utils::RewindableInput)
        tmpfile = Tempfile.open('sunstone-upload', '/mnt/sunstone_upload')
        tmpfile.write rackinput.read
        tmpfile.flush
    else
        logger.error { "Unexpected rackinput class #{rackinput.class}" }
        logger.error(rackinput.class)
        return [500, ""]
    end

    @SunstoneServer.upload(params[:img], tmpfile.path)
end

I included logger.error(rackinput.class) like above. But I can't find
the rackinput.class value. Is the above correct?

Gr. Stefan

-- 
| BIT BV  http://www.bit.nl/        Kamer van Koophandel 09090351
| GPG: 0xD14839C6                   +31 318 648 688 / info at bit.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: Digital signature
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20131129/41092eb2/attachment-0002.pgp>


More information about the Users mailing list