src/lsi/utils/hosts.py
def get_region():
    """Use the environment to get the current region"""
    global _REGION
    if _REGION is None:
        region_name = os.getenv("AWS_DEFAULT_REGION") or "us-east-1"
        region_dict = {r.name: r for r in boto.regioninfo.get_regions("ec2")}
        if region_name not in region_dict:
            raise ValueError("No such EC2 region: {}. Check AWS_DEFAULT_REGION "
                             "environment variable".format(region_name))
        _REGION = region_dict[region_name]
    return _REGION
def get_region():
    global _REGION
    if _REGION is None:
        region_name = os.getenv("AWS_DEFAULT_REGION") or "us-east-1"
        region_dict = {r.name: r for r in boto.regioninfo.get_regions("ec2")}
        if region_name not in region_dict:
            raise ValueError("No such EC2 region: {}. Check AWS_DEFAULT_REGION "
                             "environment variable".format(region_name))
        _REGION = region_dict[region_name]
    return _REGION
def get_region ( ) : global _REGION if _REGION is None : region_name = os . getenv ( "AWS_DEFAULT_REGION" ) or "us-east-1" region_dict = { r . name : r for r in boto . regioninfo . get_regions ( "ec2" ) } if region_name not in region_dict : raise ValueError ( "No such EC2 region: {}. Check AWS_DEFAULT_REGION " "environment variable" . format ( region_name ) ) _REGION = region_dict [ region_name ] return _REGION
Use the environment to get the current region
Use the environment to get the current region