Example #1
0
def step_start_new_server(context, stype, id, path):
    """
    Starts a new HTTP/FTP server at path. The port can then be retrieved through the id.
    """
    host, port = start_server_based_on_type(context,
                                            path.format(context=context),
                                            stype)
    context.dnf.ports[id] = port
Example #2
0
def make_repo_packages_accessible(context, repo, rtype):
    """
    Starts a new HTTP/FTP server at the repository's location and saves
    its port to context.
    """
    repo_info = get_repo_info(context, repo)
    host, port = start_server_based_on_type(
        context, repo_info.get_substituted_path(context), rtype)
    context.dnf.ports[repo] = port
Example #3
0
def make_repo_packages_accessible(context, repo, rtype):
    """
    Starts a new HTTP/FTP server at the repository's location and saves
    its port to context.
    """
    repo_info = get_repo_info(context, repo)
    server_dir = repo_info.path.replace("$releasever", context.dnf.releasever)
    host, port = start_server_based_on_type(context, server_dir, rtype)
    context.dnf.ports[repo] = port
Example #4
0
def step_use_repository_as(context, repo, rtype):
    """
    Starts a new HTTP/FTP server at the repository's location and then
    configures the repository's baseurl with the server's url. Also generates
    the repodata if they weren't generated yet for this run of behave.
    """
    repo_info = get_repo_info(context, repo)
    server_dir = repo_info.get_substituted_path(context)

    if rtype == "https":
        certs = {
            "cacert":
            os.path.join(context.dnf.fixturesdir,
                         'certificates/testcerts/ca/cert.pem'),
            "cert":
            os.path.join(context.dnf.fixturesdir,
                         'certificates/testcerts/server/cert.pem'),
            "key":
            os.path.join(context.dnf.fixturesdir,
                         'certificates/testcerts/server/key.pem'),
        }
        host, port = start_server_based_on_type(context, server_dir, rtype,
                                                certs)
    else:
        host, port = start_server_based_on_type(context, server_dir, rtype)

    config = {"baseurl": "{}://{}:{}/".format(rtype, host, port)}

    if rtype == "https":
        client_ssl = context.dnf._get("client_ssl")

        config["sslcacert"] = certs["cacert"]
        if client_ssl:
            config["sslclientcert"] = client_ssl["certificate"]
            config["sslclientkey"] = client_ssl["key"]

    context.dnf.ports[repo] = port

    repo_info.update_config(config)
    generate_repodata(context, repo)
    create_repo_conf(context, repo)
Example #5
0
def step_set_up_http_server(context, path):
    full_path = prepend_installroot(context, path)
    host, port = start_server_based_on_type(context, full_path, 'http')
    context.dnf.ports[path] = port