Esempio 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)
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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())
Esempio 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())
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)