Uploaded image for project: 'Multicloud'
  1. Multicloud
  2. MULTICLOUD-476

POST fails on v1 interface

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: High High
    • Dublin Release
    • Casablanca Maintenance Release
    • MULTICLOUD-OPENSTACK
    • None
    • MultiCloud Dublin M2

      After setting up SO to call the multicloud a failure similar to the one below was received 

      this is beacuse in the python class 

       multivimbroker / multivimbroker / forwarder / views.py

      class APIv1InfraWorkload(BaseServer):

      def post(self, request, cloud_owner, cloud_region_id):
             vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)
             if len(request.FILES) != 0:
                    return self.__process_multipart(request, vimid)   
             return self.send(vimid, request.get_full_path(), request.body, "POST",
                            headers=originHeaders(request))

      the request is accesses twice

      if the code is something like 

      def post(self, request, cloud_owner, cloud_region_id):
             vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id)

             body = request.body
             if len(request.FILES) != 0:
                    return self.__process_multipart(request, vimid)   
             return self.send(vimid, request.get_full_path(), body, "POST",
                            headers=originHeaders(request))

      then there is no problem

       

      2019-02-06 17:57:37|||||django.request||140405647959872||handle_uncaught_exception||ERROR||Internal Server Error: /api/multicloud/v1/CloudOwner/regionOne/infra_workload/b4013d57-408e-4a7d-a322-65869c598408/||||requestID=766690fd-ccb8-3135-82b2-678e9825c2ba invocationID=a9c81420-8c30-437e-b82e-26499688ba07 serviceName=multicloud-broker serviceIP=10.42.52.74 2019-02-06 17:57:37|||||django.request||140405647959872||handle_uncaught_exception||ERROR||Internal Server Error: /api/multicloud/v1/CloudOwner/regionOne/infra_workload/b4013d57-408e-4a7d-a322-65869c598408/||||requestID=766690fd-ccb8-3135-82b2-678e9825c2ba invocationID=a9c81420-8c30-437e-b82e-26499688ba07 serviceName=multicloud-broker serviceIP=10.42.52.74 Traceback (most recent call last):  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response    response = self.process_exception_by_middleware(e, request)  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response    response = wrapped_callback(request, *callback_args, **callback_kwargs)  File "/usr/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view    return view_func(*args, **kwargs)  File "/usr/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view    return self.dispatch(request, *args, **kwargs)  File "/usr/local/lib/python2.7/site-packages/rest_framework/views.py", line 466, in dispatch    response = self.handle_exception(exc)  File "/usr/local/lib/python2.7/site-packages/rest_framework/views.py", line 463, in dispatch    response = handler(request, *args, **kwargs)  File "./multivimbroker/forwarder/views.py", line 275, in post    return self.send(vimid, request.get_full_path(), request.body , "POST",  File "/usr/local/lib/python2.7/site-packages/rest_framework/request.py", line 357, in _getattribute_    return getattr(self._request, attr)  File "/usr/local/lib/python2.7/site-packages/django/http/request.py", line 259, in body    raise RawPostDataException("You cannot access body after reading from request's data stream")RawPostDataException: You cannot access body after reading from request's data stream

       

       

            ethanlynnl ethanlynnl
            afenner afenner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: