Пример #1
0
    def post(self, request, *args, **kwargs):
        nh_form = NewHostForm()
        nr_form = NewRunForm(request.POST)
        context = {'new_host_form': nh_form}
        context['new_run_form'] = nr_form

        if nr_form.is_valid():
            run_object = Run.objects.bulk_create_for_run(nr_form.cleaned_data['hosts'])
            from report.runner import run
            run(run_object)
            return HttpResponseRedirect(reverse('results-list'))
        else:
            return self.render_to_response(context)
Пример #2
0
 def get(self, request, *args, **kwargs):
     #localhost = Host.localhost()
     #run_object = Run.objects.create_for_host(localhost)
     from report.runner import run
     #run(request, run_object)
     try:
         run(request)
     except RuntimeError as ex:
         return return_error(request, str(ex))
     except Exception as ex:
         logger.critical(traceback.format_exc())
         return return_error(request, 'There was an error: \'%s\'' % str(ex))
     return HttpResponseRedirect(reverse('results-list'))
Пример #3
0
    def post(self, request, *args, **kwargs):
        nh_form = NewHostForm()
        nr_form = NewRunForm(request.POST)
        context = {'new_host_form': nh_form}
        context['new_run_form'] = nr_form

        if nr_form.is_valid():
            run_object = Run.objects.bulk_create_for_run(
                nr_form.cleaned_data['hosts'])
            from report.runner import run
            run(run_object)
            return HttpResponseRedirect(reverse('results-list'))
        else:
            return self.render_to_response(context)
Пример #4
0
 def get(self, request, *args, **kwargs):
     #localhost = Host.localhost()
     #run_object = Run.objects.create_for_host(localhost)
     from report.runner import run
     #run(request, run_object)
     try:
         run(request)
     except RuntimeError as ex:
         return return_error(request, str(ex))
     except Exception as ex:
         logger.critical(traceback.format_exc())
         return return_error(request,
                             'There was an error: \'%s\'' % str(ex))
     return HttpResponseRedirect(reverse('results-list'))