# Path: loadsbroker/aws.py
# AWS_REGIONS = (
#     # "ap-northeast-1", "ap-southeast-1", "ap-southeast-2",  # speeding up
#     "eu-west-1",
#     # "sa-east-1",   # this one times out
#     "us-east-1",
#     "us-west-1",
#     "us-west-2"
# )


from io import StringIO
from functools import wraps
from loadsbroker.aws import AWS_REGIONS
    from boto.ec2 import connect_to_region
import sys
import subprocess
import requests
import time
import os
import boto
    import logging
    s.seek(0)
    boto.config.clear()
    return s.read(), endpoints


def load_boto_context(config, endpoints=None):
    s = StringIO()
    s.write(config)
    boto.config.clear()
    boto.config.read(s)
    if endpoints is not None:
        os.environ['BOTO_ENDPOINTS'] = endpoints


def boto_cleared(func):
    @wraps(func)
    def _cleared(*args, **kwargs):
        context, endpoints = clear_boto_context()
        try:
            return func(*args, **kwargs)
        finally:
            load_boto_context(context, endpoints)
    return _cleared


def create_images():
    logging.getLogger('boto').setLevel(logging.CRITICAL)

    # late import so BOTO_ENDPOINTS is seen


# Path: loadsbroker/aws.py
# AWS_REGIONS = (
#     # "ap-northeast-1", "ap-southeast-1", "ap-southeast-2",  # speeding up
#     "eu-west-1",
#     # "sa-east-1",   # this one times out
#     "us-east-1",
#     "us-west-1",
#     "us-west-2"
# )


# Path: loadsbroker/tests/util.py
from io import StringIO
from functools import wraps
from loadsbroker.aws import AWS_REGIONS
    from boto.ec2 import connect_to_region
import sys
import subprocess
import requests
import time
import os
import boto
    import logging

    s.seek(0)
    boto.config.clear()
    return s.read(), endpoints


def load_boto_context(config, endpoints=None):
    s = StringIO()
    s.write(config)
    boto.config.clear()
    boto.config.read(s)
    if endpoints is not None:
        os.environ['BOTO_ENDPOINTS'] = endpoints


def boto_cleared(func):
    @wraps(func)
    def _cleared(*args, **kwargs):
        context, endpoints = clear_boto_context()
        try:
            return func(*args, **kwargs)
        finally:
            load_boto_context(context, endpoints)
    return _cleared


def create_images():
    logging.getLogger('boto').setLevel(logging.CRITICAL)

    # late import so BOTO_ENDPOINTS is seen


    for region in AWS_REGIONS: