def container_cdn_command(self, url, container, sfile=None): """Command your CDN enabled Container. :param url: :param container: """ rty_count = ARGS.get('error_retry') for retry in basic.retryloop(attempts=rty_count, delay=2, obj=sfile): # Open Connection conn = http.open_connection(url=url) with meth.operation(retry, conn): cheaders = self.payload['headers'] if sfile is not None: rpath = http.quoter(url=url.path, cont=container, ufile=sfile) # perform CDN Object DELETE conn.request('DELETE', rpath, headers=cheaders) resp, read = http.response_get(conn=conn, retry=retry) self.resp_exception(resp=resp, rty=retry) else: rpath = http.quoter(url=url.path, cont=container) http.cdn_toggle(headers=cheaders) # perform CDN Enable POST conn.request('PUT', rpath, headers=cheaders) resp, read = http.response_get(conn=conn, retry=retry) self.resp_exception(resp=resp, rty=retry) report.reporter( msg=('OBJECT %s MESSAGE %s %s %s' % (rpath, resp.status, resp.reason, resp.msg)), prt=False, lvl='debug')
def container_cdn_command(self, url, container, sfile=None): """Command your CDN enabled Container. :param url: :param container: """ rty_count = ARGS.get('error_retry') for retry in basic.retryloop(attempts=rty_count, delay=2, obj=sfile): # Open Connection conn = http.open_connection(url=url) with meth.operation(retry, conn): cheaders = self.payload['headers'] if sfile is not None: rpath = http.quoter(url=url.path, cont=container, ufile=sfile) # perform CDN Object DELETE conn.request('DELETE', rpath, headers=cheaders) resp, read = http.response_get(conn=conn, retry=retry) self.resp_exception(resp=resp, rty=retry) else: rpath = http.quoter(url=url.path, cont=container) http.cdn_toggle(headers=cheaders) # perform CDN Enable POST conn.request('PUT', rpath, headers=cheaders) resp, read = http.response_get(conn=conn, retry=retry) self.resp_exception(resp=resp, rty=retry) report.reporter( msg=('OBJECT %s MESSAGE %s %s %s' % (rpath, resp.status, resp.reason, resp.msg)), prt=False, lvl='debug' )
def container_cdn_command(self, url, container, sfile=None): """Command your CDN enabled Container. :param url: :param container: """ rty_count = ARGS.get("error_retry") for retry in basic.retryloop(attempts=rty_count, delay=2, obj=sfile): cheaders = self.payload["headers"] if sfile is not None: rpath = http.quoter(url=url.path, cont=container, ufile=sfile) # perform CDN Object DELETE adddata = "%s %s" % (cheaders, container) with meth.operation(retry, obj=adddata): resp = http.delete_request(url=url, rpath=rpath, headers=cheaders) self.resp_exception(resp=resp) else: rpath = http.quoter(url=url.path, cont=container) http.cdn_toggle(headers=cheaders) # perform CDN Enable PUT adddata = "%s %s" % (cheaders, container) with meth.operation(retry, obj=adddata): resp = http.put_request(url=url, rpath=rpath, headers=cheaders) self.resp_exception(resp=resp) report.reporter( msg="OBJECT %s MESSAGE %s %s %s" % (rpath, resp.status_code, resp.reason, resp.request), prt=False, lvl="debug", )
def container_cdn_command(self, url, container, sfile=None): """Command your CDN enabled Container. :param url: :param container: """ rty_count = ARGS.get('error_retry') for retry in basic.retryloop(attempts=rty_count, delay=2, obj=sfile): cheaders = self.payload['headers'] if sfile is not None: rpath = http.quoter(url=url.path, cont=container, ufile=sfile) # perform CDN Object DELETE adddata = '%s %s' % (cheaders, container) with meth.operation(retry, obj=adddata): resp = http.delete_request(url=url, rpath=rpath, headers=cheaders) self.resp_exception(resp=resp) else: rpath = http.quoter(url=url.path, cont=container) http.cdn_toggle(headers=cheaders) # perform CDN Enable PUT adddata = '%s %s' % (cheaders, container) with meth.operation(retry, obj=adddata): resp = http.put_request(url=url, rpath=rpath, headers=cheaders) self.resp_exception(resp=resp) report.reporter( msg='OBJECT %s MESSAGE %s %s %s' % (rpath, resp.status_code, resp.reason, resp.request), prt=False, lvl='debug')