Ejemplo n.º 1
0
def main(args=None):
    args = get_args(args=args)
    old_dir = os.getcwd()
    os.chdir(os.path.dirname(args.compose_file.name))
    config = include(read_config(args.compose_file), build_fetch_config(args))
    write_config(config, args.output)
    os.chdir(old_dir)
Ejemplo n.º 2
0
def get_project_from_file(url):
    # Handle urls in the form file://./some/relative/path
    old_dir = os.getcwd()
    os.chdir(os.path.dirname(url.path))
    path = url.netloc + url.path if url.netloc.startswith('.') else url.path
    with open(path, 'r') as fh:
        config = resolve_relative_paths(read_config(fh))
        os.chdir(old_dir)
        return config
Ejemplo n.º 3
0
def get_project_from_http(url, config):
    try:
        response = requests.get(url.geturl(),
                                timeout=config.get('timeout', 20),
                                verify=config.get('verify_ssl_cert', True),
                                cert=config.get('ssl_cert', None),
                                proxies=config.get('proxies', None))
        response.raise_for_status()
    except requests.exceptions.RequestException as e:
        raise FetchExternalConfigError("Failed to include %s: %s" %
                                       (url.geturl(), e))
    return read_config(response.text)
Ejemplo n.º 4
0
def get_project_from_http(url, config):
    try:
        response = requests.get(
            url.geturl(),
            timeout=config.get('timeout', 20),
            verify=config.get('verify_ssl_cert', True),
            cert=config.get('ssl_cert', None),
            proxies=config.get('proxies', None))
        response.raise_for_status()
    except requests.exceptions.RequestException as e:
        raise FetchExternalConfigError("Failed to include %s: %s" % (
            url.geturl(), e))
    return read_config(response.text)
Ejemplo n.º 5
0
def get_project_from_s3(url):
    import boto.exception

    try:
        conn = get_boto_conn()
        bucket = conn.get_bucket(url.netloc)
    except (boto.exception.BotoServerError, boto.exception.BotoClientError) as e:
        raise FetchExternalConfigError("Failed to include %s: %s" % (url.geturl(), e))

    key = bucket.get_key(url.path)
    if not key:
        raise FetchExternalConfigError("Failed to include %s: Not Found" % url.geturl())

    return read_config(key.get_contents_as_string())
Ejemplo n.º 6
0
def get_project_from_s3(url):
    import boto.exception
    try:
        conn = get_boto_conn()
        bucket = conn.get_bucket(url.netloc)
    except (boto.exception.BotoServerError,
            boto.exception.BotoClientError) as e:
        raise FetchExternalConfigError("Failed to include %s: %s" %
                                       (url.geturl(), e))

    key = bucket.get_key(url.path)
    if not key:
        raise FetchExternalConfigError("Failed to include %s: Not Found" %
                                       url.geturl())

    return read_config(key.get_contents_as_string())
Ejemplo n.º 7
0
def get_project_from_file(url):
    # Handle urls in the form file://./some/relative/path
    path = url.netloc + url.path if url.netloc.startswith('.') else url.path
    with open(path, 'r') as fh:
        return read_config(fh)
Ejemplo n.º 8
0
def main(args=None):
    args = get_args(args=args)
    config = include(read_config(args.compose_file), build_fetch_config(args))
    write_config(config, args.output)
Ejemplo n.º 9
0
def main(args=None):
    args = get_args(args=args)
    config = add_namespace(read_config(args.compose_file), args.namespace)
    write_config(config, args.output)
Ejemplo n.º 10
0
def main(args=None):
    args = get_args(args=args)
    config = add_namespace(read_config(args.compose_file), args.namespace)
    write_config(config, args.output)
Ejemplo n.º 11
0
def get_project_from_file(url):
    # Handle urls in the form file://./some/relative/path
    path = url.netloc + url.path if url.netloc.startswith(".") else url.path
    with open(path, "r") as fh:
        return read_config(fh)
Ejemplo n.º 12
0
def main(args=None):
    args = get_args(args=args)
    config = include(read_config(args.compose_file), build_fetch_config(args))
    write_config(config, args.output)