Esempio n. 1
0
    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",
            )
Esempio n. 2
0
    def _deleter(self, url, rpath, fheaders):
        """Delete a specified object in the container.

        :param url:
        :param rpath:
        :param fheaders:
        """

        # perform Object Delete
        resp = http.delete_request(url=url, headers=fheaders, rpath=rpath)
        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')
Esempio n. 3
0
    def _deleter(self, url, rpath, fheaders):
        """Delete a specified object in the container.

        :param url:
        :param rpath:
        :param fheaders:
        """

        # perform Object Delete
        resp = http.delete_request(url=url, headers=fheaders, rpath=rpath)
        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",
        )
Esempio n. 4
0
    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')