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

Daniel Molina dmolina at opennebula.org
Fri Nov 29 00:31:51 PST 2013


On 29 November 2013 09:27, Stefan Kooman <stefan at bit.nl> wrote:

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

Include it before the if:
     logger.error(rackinput.class)
     if (rackinput.class == Tempfile)


> Gr. Stefan
>
> --
> | BIT BV  http://www.bit.nl/        Kamer van Koophandel 09090351
> | GPG: 0xD14839C6                   +31 318 648 688 / info at bit.nl
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iF4EAREIAAYFAlKYUAcACgkQTyGgYdFIOcbkjwEAl5SvTwtbCCmry69wMObQ09vo
> kgh9EqGgRrlfBSpFhv4A/i6LHWeKdU857PpZo2/KIoIIliyOP7Y7dqgyljrBBShi
> =DSa7
> -----END PGP SIGNATURE-----
>
>


-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmolina at opennebula.org | @OpenNebula
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20131129/6225ea82/attachment-0002.htm>


More information about the Users mailing list