Changeset 531ce3a6fd488efc448d608ddc575d3ac5545710
- Timestamp:
- 02/13/09 14:09:59 (3 years ago)
- Author:
- Frederic Lepied <frederic.lepied@…>
- Children:
- bcaf3494df73e30262f508a84aa50fad8bc1d24a
- Parents:
- 1641e797df31622a217ebb7904b766db82a1209d
- git-committer:
- Frederic Lepied <frederic.lepied@…> (02/13/09 14:09:59)
- Message:
-
pass the logid to the upload url/function
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rcb437b7
|
r531ce3a
|
|
| 75 | 75 | |
| 76 | 76 | After the execution of a test script, the result is sent back to the |
| 77 | | server using the following url: http://<ipaddr>:<port>/upload/. I |
| | 77 | server using the following url: http://<ipaddr>:<port>/upload/<test id>/. I |
| 78 | 78 | usualy run the following curl command to upload the result: |
| 79 | 79 | |
| 80 | | curl --retry 0 -s -f -F "file=@$output" http://<ipaddr>:<port>/upload/ |
| | 80 | curl --retry 0 -s -f -F "file=@$output" http://<ipaddr>:<port>/upload/<test id>/ |
| 81 | 81 | |
| 82 | 82 | These uploaded files are stored under the directory set by the |
-
|
r5fc8fc0
|
r531ce3a
|
|
| 7 | 7 | from tester.models import * |
| 8 | 8 | |
| 9 | | def upload_file(request): |
| 10 | | print 'upload_file' |
| | 9 | def upload_file(request, logid): |
| | 10 | print 'upload_file', logid |
| 11 | 11 | if request.method == 'POST': |
| 12 | 12 | form = UploadFileForm(request.POST, request.FILES) |
| 13 | 13 | mac = get_mac(request) |
| 14 | 14 | s = get_object_or_404(System, macaddress__mac=simplify_mac(mac)) |
| 15 | | logs = TestLog.objects.filter(system=s, status='S').order_by('date') |
| 16 | | if len(logs) == 0: |
| 17 | | raise Http404 |
| 18 | | log = logs[0] |
| | 15 | log = get_object_or_404(TestLog, id=logid) |
| 19 | 16 | if form.is_valid(): |
| 20 | 17 | log.status = 'D' |
| … |
… |
|
| 91 | 88 | log.status = 'S' |
| 92 | 89 | log.save() |
| 93 | | print "%s (%s) -> %s" % (s.name, mac, name) |
| 94 | | return render_to_response(name + settings.TEST_SUFFIX, {'testname': name, 'system': s.name}) |
| | 90 | else: |
| | 91 | log = None |
| | 92 | print "%s (%s) -> %s (%s)" % (s.name, mac, name, str(log)) |
| | 93 | return render_to_response(name + settings.TEST_SUFFIX, {'testname': name, 'system': s.name, 'log': log}) |
| 95 | 94 | |
| 96 | 95 | def logs(request, verid): |
| … |
… |
|
| 102 | 101 | log = get_object_or_404(TestLog, id=logid) |
| 103 | 102 | infos = InfoLine.objects.filter(log=log).order_by('id') |
| 104 | | return render_to_response('log.html', {'log': log, 'infos': infos}) |
| | 103 | return render_to_response('log.html', {'log': log, 'infos': infos}) |
| 105 | 104 | |
| 106 | 105 | def content(request, logid): |
-
|
r5fc8fc0
|
r531ce3a
|
|
| 18 | 18 | (r'^profile/$', 'pxe.views.profile1'), |
| 19 | 19 | |
| 20 | | (r'^upload/$', 'tester.views.upload_file'), |
| | 20 | (r'^upload/(?P<logid>[0-9]+)/$', 'tester.views.upload_file'), |
| 21 | 21 | (r'^nexttest/$', 'tester.views.next_test1'), |
| 22 | 22 | (r'^nexttest/(?P<mac>[a-fA-F0-9:-]+)/$', 'tester.views.next_test'), |