@exception.wrap_pecan_controller_exception
    @pecan.expose('json', content_type='application/json-patch+json')
    def patch(self, uuid):
        """Patch an existing CAMP-style plan."""

        handler = (plan_handler.
                   PlanHandler(pecan.request.security_context))
        plan_obj = handler.get(uuid)

        # TODO(gilbert.pilz@oracle.com) check if there are any assemblies that
        # refer to this plan and raise an PlanStillReferenced exception if
        # there are.

        if not pecan.request.body or len(pecan.request.body) < 1:
            raise exception.BadRequest(reason='empty request body')

        # check to make sure the request has the right Content-Type
        if (pecan.request.content_type is None or
                pecan.request.content_type != 'application/json-patch+json'):
            raise exception.UnsupportedMediaType(
                name=pecan.request.content_type,
                method='PATCH')

        try:
            patch = jsonpatch.JsonPatch.from_string(pecan.request.body)
            patched_obj = patch.apply(plan_obj.refined_content())
            db_obj = handler.update(uuid, patched_obj)
        except __HOLE__:
            # a key error indicates one of the patch operations is missing a
            # component
            raise exception.BadRequest(reason=MAL_PATCH_ERR)
        except jsonpatch.JsonPatchConflict:
            raise exception.Unprocessable
        except jsonpatch.JsonPatchException as jpe:
            raise JsonPatchProcessingException(reason=six.text_type(jpe))

        return fluff_plan(db_obj.refined_content(), db_obj.uuid)
dataset/ETHPy150Open openstack/solum/solum/api/controllers/camp/v1_1/plans.py/PlansController.patch