예제 #1
0
        no_snap = no_install or \
            man.get_config_option('no_snapshot')

        # starting from a base image doesn't work if the base image
        # has fewer drives than the current manifest you're loading
        run_command(
            "./make_base_container.py "
            "{} {} {} {} {}".format(distro, container_name, vol_size,
                                    vol_count, base_image), RUNWAY_DIR)

        setup_and_run_ansible_on_guest.setup_and_run_ansible(
            container_name,
            debug=debug,
            drive_count=vol_count,
            tiny_install=tiny_deploy)

        if not no_install:
            run_command("./generic_installer.py {}".format(container_name),
                        RUNWAY_DIR)
        if not no_snap:
            run_command(
                "./snapshot_created_container.sh "
                "{} {}{}".format(container_name, base_image, debug_string),
                RUNWAY_DIR)
    except Exception as e:
        colorprint.error(str(e))
        sys.exit(1)

    colorprint.success("Container '{}' successfully "
                       "created.\n".format(container_name))
예제 #2
0
    # Vagrant up
    if os.environ.get("CONTROLLER_NAME") is None:
        colorprint.warning(
            "WARNING: CONTROLLER_NAME env var hasn't been set. "
            "If you fail to 'vagrant up' your VM, open "
            "VirtualBox, check the name of your SCSI "
            "Controller and provide it in the CONTROLLER_NAME "
            "env var."
        )
    vagrant_env_vars = {
        "VOL_SIZE": "{}".format(vol_size_in_mebibytes(vol_size)),
        "VOL_COUNT": "{}".format(vol_count),
    }
    try:
        run_command("vagrant up", cwd=RUNWAY_DIR, env=vagrant_env_vars)
        colorprint.success("VM successfully created.")
        colorprint.info("VM needs to be rebooted before container creation.")
        run_command("vagrant reload", cwd=RUNWAY_DIR)
        colorprint.info("Creating container...")
        create_container_cmd = "./create_container.sh -d {}".format(distro)
        if container_name is not None:
            create_container_cmd += " --container-name {}".format(container_name)
        if provided_workspace_name:
            create_container_cmd += " --workspace {}".format(workspace_name)
        run_command(create_container_cmd, cwd=BIN_DIR)
    except Exception as e:
        exit_on_error(str(e))

    elapsed_time = time.time() - start_time

    # Log into our brand new container?
예제 #3
0
                        default=None,
                        help="Workspace name")

    args = parser.parse_args()
    manifest_file = os.path.abspath(args.manifest)
    workspace_name = args.workspace

    # Create new workspace directory
    try:
        new_workspace_path = create_workspace_dir(workspace_name)
    except Exception as e:
        exit_with_error(e.message)

    colorprint.info("\nRetrieving components into workspace at '{}'..."
                    "\n".format(new_workspace_path))

    # Copy manifest into workspace
    manifest_copy_path = os.path.join(new_workspace_path, MANIFEST_COPY_NAME)
    if not os.path.isfile(manifest_copy_path):
        copyfile(manifest_file, manifest_copy_path)

    # Retrieve contents
    try:
        current_manifest = Manifest(manifest_copy_path, new_workspace_path)
        current_manifest.retrieve_components()
    except Exception as e:
        exit_with_error(e.message)

    colorprint.success("Guest workspace successfully set up at "
                       "'{}'.".format(new_workspace_path))
예제 #4
0
    # Vagrant up
    if os.environ.get('CONTROLLER_NAME') is None:
        colorprint.warning("WARNING: CONTROLLER_NAME env var hasn't been set. "
                           "If you fail to 'vagrant up' your VM, open "
                           "VirtualBox, check the name of your SCSI "
                           "Controller and provide it in the CONTROLLER_NAME "
                           "env var.")
    vagrant_env_vars = {
        'DISTRO': distro,
        'VOL_SIZE': "{}".format(vol_size_in_mebibytes(vol_size)),
        'VOL_COUNT': "{}".format(vol_count),
    }
    try:
        run_command("vagrant up", cwd=RUNWAY_DIR, env=vagrant_env_vars)
        colorprint.info("VM and container need to be rebooted after install.")
        colorprint.info("Stopping container...")
        run_command("./stop_container.sh", cwd=BIN_DIR)
        colorprint.info("Restarting VM...")
        run_command("vagrant reload", cwd=RUNWAY_DIR)
        colorprint.info("Starting container...")
        run_command("./start_container.sh", cwd=BIN_DIR)
    except Exception as e:
        exit_on_error(e.message)

    # Log into our brand new container?
    colorprint.success("Your new container is now up and running! If you want "
                       "to log into it, just run the following command from "
                       "the runway directory:\n\n\t"
                       "bin/bash_on_current_container.sh")