Example #1
0
    def __enter__(self):
        self._stdout_file = tempfile.mktemp()
        FileCapture.watch(self._stdout_file, 'ecservice.py stdout')

        cmd = [
            'ecservice.py',
            '--config=%s' % self.service_config.filename,
        ]
        self._process = subprocess.Popen(
            cmd,
            stdout=open(self._stdout_file, 'w+'),
            stderr=subprocess.STDOUT,
            preexec_fn=os.setsid,
        )

        url = '%s/%s/_noop' % (self.service_config.endpoint, _api_version)
        for i in range(0, 10):
            try:
                response = requests.get(url)
                if response.status_code == httplib.OK:
                    return self
            except:
                pass

            time.sleep(0.5)

        ex_msg = 'Could not confirm service started @ %s' % url
        ex = Exception(ex_msg)
        raise ex
Example #2
0
    def __enter__(self):
        self._stdout_file = tempfile.mktemp()
        FileCapture.watch(self._stdout_file, 'ecservice.py stdout')

        cmd = [
            'ecservice.py',
            '--config=%s' % self.service_config.filename,
        ]
        self._process = subprocess.Popen(
            cmd,
            stdout=open(self._stdout_file, 'w+'),
            stderr=subprocess.STDOUT,
            preexec_fn=os.setsid,
        )

        url = '%s/%s/_noop' % (self.service_config.endpoint, _api_version)
        for i in range(0, 10):
            try:
                response = requests.get(url)
                if response.status_code == httplib.OK:
                    return self
            except Exception:
                pass

            time.sleep(0.5)

        ex_msg = 'Could not confirm service started @ %s' % url
        ex = Exception(ex_msg)
        raise ex
Example #3
0
    def __enter__(self):
        section = 'ecs'

        cp = ConfigParser()
        cp.add_section(section)

        cp.set(section, 'address', self._ip)
        cp.set(section, 'port', self._port)
        cp.set(section, 'log_level', 'info')
        cp.set(section, 'max_concurrent_executing_http_requests', '250')
        cp.set(section, 'docker_remote_api', 'http://172.17.0.1:2375')
        cp.set(section, 'docker_remote_api_connect_timeout', 3 * 1000)
        cp.set(section, 'docker_remote_api_request_timeout', 5 * 60 * 1000)

        self.filename = tempfile.mktemp()
        with open(self.filename, 'w+') as fp:
            cp.write(fp)

        FileCapture.watch(self.filename, type(self).__name__)

        return self
Example #4
0
    def __enter__(self):
        section = 'ecs'

        cp = ConfigParser()
        cp.add_section(section)

        cp.set(section, 'address', self._ip)
        cp.set(section, 'port', self._port)
        cp.set(section, 'log_level', 'info')
        cp.set(section, 'max_concurrent_executing_http_requests', '250')
        cp.set(section, 'docker_remote_api', 'http://172.17.0.1:2375')
        cp.set(section, 'docker_remote_api_connect_timeout', 3 * 1000)
        cp.set(section, 'docker_remote_api_request_timeout', 5 * 60 * 1000)

        self.filename = tempfile.mktemp()
        with open(self.filename, 'w+') as fp:
            cp.write(fp)

        FileCapture.watch(self.filename, type(self).__name__)

        return self