Exemple #1
0
def main(args, base_path, top_level):
    """
    :param list args: The arguments passed to the script.
    :param FilePath base_path: The executable being run.
    :param FilePath top_level: The top-level of the Flocker repository.
    """
    options = RunOptions(top_level=top_level)

    try:
        options.parseOptions(args)
    except UsageError as e:
        sys.exit("%s: %s\n" % (base_path.basename(), e))

    distribution = options['distribution']
    package_manager = DOCKER_IMAGES[distribution].package_manager
    package_source = options['package_source']
    if options['pip']:
        virtualenv = 'flocker-client'
        steps = [
            ensure_minimal_setup(package_manager),
            task_cli_pip_prereqs(package_manager),
            task_cli_pip_install(virtualenv, package_source),
            task_cli_pip_test(virtualenv),
        ]
    else:
        steps = [
            ensure_minimal_setup(package_manager),
            task_cli_pkg_install(distribution, package_source),
            task_cli_pkg_test(),
        ]
    runner = DockerRunner(DOCKER_IMAGES[distribution].image)
    runner.start()
    try:
        for commands in steps:
            status = runner.execute(commands)
            if status != 0:
                sys.exit(status)
    finally:
        runner.stop()
Exemple #2
0
def main(args, base_path, top_level):
    """
    :param list args: The arguments passed to the script.
    :param FilePath base_path: The executable being run.
    :param FilePath top_level: The top-level of the Flocker repository.
    """
    options = RunOptions(top_level=top_level)

    try:
        options.parseOptions(args)
    except UsageError as e:
        sys.exit("%s: %s\n" % (base_path.basename(), e))

    distribution = options['distribution']
    package_manager = DOCKER_IMAGES[distribution].package_manager
    package_source = options['package_source']
    if options['pip']:
        virtualenv = 'flocker-client'
        steps = [
            ensure_minimal_setup(package_manager),
            task_cli_pip_prereqs(package_manager),
            task_cli_pip_install(virtualenv, package_source),
            task_cli_pip_test(virtualenv),
        ]
    else:
        steps = [
            ensure_minimal_setup(package_manager),
            task_cli_pkg_install(distribution, package_source),
            task_cli_pkg_test(),
        ]
    runner = DockerRunner(DOCKER_IMAGES[distribution].image)
    runner.start()
    try:
        for commands in steps:
            status = runner.execute(commands)
            if status != 0:
                sys.exit(status)
    finally:
        runner.stop()
Exemple #3
0
def get_steps_pip(distribution, package_source=PackageSource()):
    """
    Get commands to run for testing client pip installation.

    :param bytes distribution: The distribution the node is running.
    :param PackageSource package_source: The source from which to install the
        package.

    :return: An ``Effect`` to pass to a ``Dispatcher`` that supports
        ``Sequence``, ``Run``, ``Sudo``, ``Comment``, and ``Put``.
    """
    if distribution not in PIP_DISTRIBUTIONS:
        raise UsageError(
            "Distribution %r not supported. Available distributions: %s"
            % (distribution, ', '.join(PIP_DISTRIBUTIONS)))
    package_manager = DOCKER_IMAGES[distribution].package_manager
    virtualenv = 'flocker-client'
    steps = [
        ensure_minimal_setup(package_manager),
        task_cli_pip_prereqs(package_manager),
        task_cli_pip_install(virtualenv, package_source),
        cli_pip_test(virtualenv, package_source),
    ]
    return steps