Exemplo n.º 1
0
def add_test_users():
    network = get_network()
    settings = get_settings(quiet=True)

    command = get_docker_run_cmd(network)

    password_group = settings['password_group']
    if password_group is not None:
        command += add_secure_config(password_group)

    name = get_image_name(montagu_cli, versions.api)

    run_cmd(command, name, [
        "add", "Test Admin", "test.admin", "*****@*****.**",
        "password", "--if-not-exists"
    ])
    run_cmd(command, name, ["addRole", "test.admin", "user"])
    run_cmd(command, name, ["addRole", "test.admin", "touchstone-reviewer"])
    run_cmd(command, name, ["addRole", "test.admin", "admin"])

    run_cmd(command, name, [
        "add", "Test Modeller", "test.modeller",
        "*****@*****.**", "password", "--if-not-exists"
    ])
    run_cmd(command, name, ["addRole", "test.modeller", "user"])
    run_cmd(command, name, ["addUserToGroup", "test.modeller", "IC-Garske"])
    run_cmd(command, name,
            ["addUserToGroup", "test.modeller", "Harvard-Sweet"])
Exemplo n.º 2
0
 def work():
     image = get_image_name("montagu-api-blackbox-tests", versions.api)
     pull(image)
     run([
         "docker", "run", "--rm", "--network", "montagu_default", "-v",
         "montagu_emails:/tmp/montagu_emails", image
     ],
         check=True)
Exemplo n.º 3
0
def add_user(name, id, email, password):
    network = get_network()
    command = get_docker_run_cmd(network)
    image = get_image_name(montagu_cli, versions.api)

    run_cmd(command, image,
            ["add", name, id, email, password, "--if-not-exists"])
    run_cmd(command, image, ["addRole", name, "user"])
Exemplo n.º 4
0
def cli():
    settings = get_settings(quiet=True)

    command = get_docker_run_cmd("montagu_default")

    password_group = settings['password_group']
    if password_group is not None:
        command += add_secure_config(password_group)

    name = get_image_name(montagu_cli, versions.api)
    args = sys.argv[1:]

    run(command + [name] + args)
Exemplo n.º 5
0
def cli(command):
    image = get_image_name("orderly-web-user-cli", "master")
    pull(image)
    result = run([
        "docker", "run", "--rm", "-v", "montagu_orderly_volume:/orderly",
        "--network", "montagu_default", image
    ] + command,
                 stderr=PIPE,
                 stdout=PIPE)
    print(result.stderr)
    print(result.stdout)
    if result.returncode > 0:
        print(result.args)
        print("Warning: failed to execute command")
Exemplo n.º 6
0
    def work():
        cwd = os.getcwd()

        run(["docker", "volume", "create", "orderly_volume"], check=True)

        orderly_image = get_image_name("orderly.server", "master")
        pull(orderly_image)
        run([
            "docker", "run", "-d", "-p", "8321:8321", "--network",
            "montagu_default", "-v", "orderly_volume:/orderly", "-w",
            "/orderly", "--name", "montagu_orderly_orderly_1", orderly_image,
            "--port", "8321", "--go-signal", "/go_signal", "/orderly"
        ],
            check=True)

        run([
            "docker", "exec", "montagu_orderly_orderly_1", "Rscript", "-e",
            "orderly:::create_orderly_demo('/orderly')"
        ],
            check=True)

        run([
            "docker", "exec", "montagu_orderly_orderly_1", "orderly",
            "rebuild", "--if-schema-changed"
        ],
            check=True)

        run([
            "docker", "exec", "montagu_orderly_orderly_1", "touch",
            "/go_signal"
        ],
            check=True)

        ow_image = get_image_name("orderly-web", "master")
        pull(ow_image)
        run([
            "docker", "run", "-d", "-p", "8888:8888", "--network",
            "montagu_default", "-v", "orderly_volume:/orderly", "-v",
            cwd + "/container_config/orderlyweb:/etc/orderly/web", "--name",
            "montagu_orderly_web_1", ow_image
        ],
            check=True)

        run([
            "docker", "exec", "montagu_orderly_web_1", "touch",
            "/etc/orderly/web/go_signal"
        ],
            check=True)

        ow_migrate_image = get_image_name("orderlyweb-migrate", "master")
        pull(ow_migrate_image)
        run([
            "docker", "run", "--rm", "-v", "orderly_volume:/orderly",
            ow_migrate_image
        ],
            check=True)

        ow_cli_image = get_image_name("orderly-web-user-cli", "master")
        pull(ow_cli_image)

        # user for api blackbox tests
        add_user("*****@*****.**", ow_cli_image)
        grant_permissions("*****@*****.**", ow_cli_image, ["*/users.manage"])

        # add task q user
        add_user("*****@*****.**", ow_cli_image)
        grant_permissions(
            "*****@*****.**", ow_cli_image,
            ["*/reports.run", "*/reports.review", "*/reports.read"])

        # user for webapp tests
        add_user("*****@*****.**", ow_cli_image)
        grant_permissions("*****@*****.**", ow_cli_image,
                          ["*/users.manage"])
Exemplo n.º 7
0
def run_cert_tool(mode, volume_path, args=[], stdout=PIPE):
    image = get_image_name("montagu-cert-tool", versions.cert_tool)
    volume = "{}:{}".format(abspath(volume_path), "/working")
    command = ["docker", "run", "--rm", "-v", volume, image, mode]
    run(command + args, stdout=stdout, stderr=PIPE)