Exemplo n.º 1
0
from . import cluster
from . import nemesis
from .cluster import CassandraCluster
from .cluster import LoaderSet
from .cluster import RemoteCredentials
from .cluster import ScyllaCluster
from .data_path import get_data_path

try:
    from botocore.vendored.requests.packages.urllib3.contrib.pyopenssl import extract_from_urllib3

    # Don't use pyOpenSSL in urllib3 - it causes an ``OpenSSL.SSL.Error``
    # exception when we try an API call on an idled persistent connection.
    # See https://github.com/boto/boto3/issues/220
    extract_from_urllib3()
except ImportError:
    pass

TEST_LOG = logging.getLogger('avocado.test')


class FlakyRetryPolicy(RetryPolicy):
    """
    A retry policy that retries 5 times
    """
    def on_read_timeout(self, *args, **kwargs):
        if kwargs['retry_num'] < 5:
            TEST_LOG.debug("Retrying read after timeout. Attempt #%s",
                           str(kwargs['retry_num']))
            return self.RETRY, None
# https://github.com/boto/botocore/issues/760
# https://github.com/boto/boto3/issues/220#issuecomment-171477361
from __future__ import absolute_import
try:
    from botocore.vendored.requests.packages.urllib3.contrib import pyopenssl
    pyopenssl.extract_from_urllib3()
except ImportError:
    pass
Exemplo n.º 3
0
from botocore.exceptions import EndpointConnectionError
from botocore.exceptions import ConnectionClosedError
from botocore.compat import filter_ssl_warnings
from botocore.utils import is_valid_endpoint_url
from botocore.hooks import first_non_none_response
from botocore.response import StreamingBody
from botocore import parsers


logger = logging.getLogger(__name__)
DEFAULT_TIMEOUT = 60
filter_ssl_warnings()

try:
    from botocore.vendored.requests.packages.urllib3.contrib import pyopenssl
    pyopenssl.extract_from_urllib3()
except ImportError:
    pass


def convert_to_response_dict(http_response, operation_model):
    """Convert an HTTP response object to a request dict.

    This converts the requests library's HTTP response object to
    a dictionary.

    :type http_response: botocore.vendored.requests.model.Response
    :param http_response: The HTTP response from an AWS service request.

    :rtype: dict
    :return: A response dictionary which will contain the following keys:
Exemplo n.º 4
0
An EBS implementation of the ``IBlockDeviceAPI``.
"""

from types import NoneType
from subprocess import check_output
import threading
import time
import logging
import itertools

# Don't use pyOpenSSL in urllib3 - it causes an ``OpenSSL.SSL.Error``
# exception when we try an API call on an idled persistent connection.
# See https://github.com/boto/boto3/issues/220
from botocore.vendored.requests.packages.urllib3.contrib.pyopenssl import extract_from_urllib3

extract_from_urllib3()

import boto3

from botocore.exceptions import ClientError, EndpointConnectionError

# There is no boto3 equivalent of this yet.
# See https://github.com/boto/boto3/issues/313
from boto.utils import get_instance_metadata

from uuid import UUID

from bitmath import Byte, GiB

from characteristic import with_cmp
from pyrsistent import PClass, field, pset, pmap, thaw