@decorators.detail_route(methods=['post'])
    def provision(self, request, uuid=None):
        """
        Schedule head(first) template provision synchronously, tail templates - as task.

        To start a template group provisioning, issue **POST** request against */api/templates-groups/<uuid>/provision/*
        with a list of templates' additional options. Additional options should contain options
        for what should be added to template options and passed to resource provisioning endpoint.

        Additional options example:

        .. code-block:: javascript

            [
                // options for first template
                {
                    "name": "test-openstack-instance",
                    "system_volume_size": 20
                },
                // options for second template
                {
                    "host_group": "zabbix-host-group"
                }
            ]

        Method will return validation errors if they occurs on head template provision.
        If head template provision succeed - method will return URL of template group result.
        """
        group = self.get_object()
        templates_additional_options = self._get_templates_additional_options(request)
        # execute request to head(first) template and raise exception if its validation fails
        try:
            response = group.schedule_head_template_provision(request, templates_additional_options)
        except models.TemplateActionException as e:
            return Response({'error_message': str(e)}, status=status.HTTP_400_BAD_REQUEST)
        if not response.ok:
            try:
                return Response(response.json(), status=response.status_code)
            except JSONDecodeError:
                return Response(
                    {'Error message': response.content % 'cannot schedule head template provision %s'},
                    status=response.status_code)
        # schedule tasks for other templates provision
        result = group.schedule_tail_templates_provision(request, templates_additional_options, response)
        serialized_result = serializers.TemplateGroupResultSerializer(result, context={'request': request}).data
        return Response(serialized_result, status=status.HTTP_200_OK)
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/template/views.py/TemplateGroupViewSet.provision/swapped operands of `%`