From 15a7bcd11f3224a320813e9921e8de682a337827 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Fri, 26 May 2006 14:39:11 +0000 Subject: classes/tinderclient.bbclass: Retry sending, Clean package when failing Retry to connect the tinderbox a couple of times. This is needed on machines behind broken routers. When a package is broken (PackageFailed/TaskFailed) we will clean the package so we can retry the next time. --- classes/tinderclient.bbclass | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'classes') diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index f9243f7108..fdd16d9113 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -1,3 +1,21 @@ +def tinder_http_post(server, selector, content_type, body): + import httplib + # now post it + for i in range(0,5): + try: + h = httplib.HTTP(server) + h.putrequest('POST', selector) + h.putheader('content-type', content_type) + h.putheader('content-length', str(len(body))) + h.endheaders() + h.send(body) + errcode, errmsg, headers = h.getreply() + #print errcode, errmsg, headers + return (errcode,errmsg, headers, h.file) + except: + # try again + pass + def tinder_form_data(bound, dict, log): output = [] #br @@ -29,7 +47,7 @@ def tinder_format_http_post(d,status,log): for the tinderbox to be happy. """ - from bb import data + from bb import data, build import os,random # the variables we will need to send on this form post @@ -72,7 +90,6 @@ def tinder_build_start(d): on the server. """ from bb import data - import httplib # get the body and type content_type, body = tinder_format_http_post(d,None,None) @@ -84,15 +101,9 @@ def tinder_build_start(d): #print "selector %s and url %s" % (selector, url) # now post it - h = httplib.HTTP(server) - h.putrequest('POST', selector) - h.putheader('content-type', content_type) - h.putheader('content-length', str(len(body))) - h.endheaders() - h.send(body) - errcode, errmsg, headers = h.getreply() + errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) #print errcode, errmsg, headers - report = h.file.read() + report = h_file.read() # now let us find the machine id that was assigned to us search = "