Example #1
0
 def init(self, rs, mission):
     self.mission = mission
     self.rs = rs
     super(ProgressHostRunTask, self).init()
     if self.rs["retcode"] == 1:
         raise ReleaseError('滚动发布失败')
Example #2
0
                        self.host, port,
                        'http://%s:%s%s' % (self.item, port, m["warmup_url"]),
                        m["expected_codes"], m["expected_text"])
                    # if t_result:
                    #     pass
                    # else:
                    if not t_result:
                        warm_url = m
                        all_status = False
                        break
            if all_status:
                return get_result(0, 'done')
            else:
                raise ReleaseError('warm this url %s failed' % warm_url)
        else:
            raise ReleaseError('can not find this item in %s' % self.app_path)

    @staticmethod
    def check(host, port, url, expected_codes, expected_text, method='GET'):
        conn = httplib.HTTPConnection(host, port)
        conn.connect()
        conn.request(method, url)
        resp = conn.getresponse()
        code = resp.status
        logger.debug('url%s ,expect_code  type %s, code %s' %
                     (url, expected_codes, code))
        flag = False
        if expected_codes:
            if str(code) in [str(x) for x in expected_codes]:
                flag = True
            else: