def installer_gather(ip, ssh_key, out_dir):
    stdout, stderr, _ret = utils.run_command(
        f"{INSTALLER_BINARY} gather bootstrap --log-level debug --bootstrap {ip} --master {ip} --key {ssh_key}"
    )

    with open(INSTALLER_GATHER_DEBUG_STDOUT, "w") as f:
        f.write(stdout)

    with open(INSTALLER_GATHER_DEBUG_STDERR, "w") as f:
        f.write(stderr)

    matches = re.compile(r'.*logs captured here "(.*)".*').findall(stderr)

    if len(matches) == 0:
        logging.warning(
            f"It seems like installer-gather didn't generate any bundles, stderr: {stderr}"
        )
        return

    bundle_file_path, *_ = matches

    logging.info(f"Found installer-gather bundle at path {bundle_file_path}")

    utils.run_command_with_output(f"tar -xzf {bundle_file_path} -C {out_dir}")
    os.remove(bundle_file_path) if os.path.exists(bundle_file_path) else None
def installer_generate(openshift_release_image):
    logging.info("Installer generate ignitions")
    bip_env = {
        "OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE": openshift_release_image
    }
    utils.run_command_with_output(
        f"{INSTALLER_BINARY} create single-node-ignition-config --dir={IBIP_DIR}",
        env=bip_env)
Ejemplo n.º 3
0
def _try_to_delete_nodes(tf_folder):
    log.info('Start running terraform delete')
    with utils.file_lock_context():
        utils.run_command_with_output(f'cd {tf_folder} && '
                                      'terraform destroy '
                                      '-auto-approve '
                                      '-input=false '
                                      '-state=terraform.tfstate '
                                      '-state-out=terraform.tfstate '
                                      '-var-file=terraform.tfvars.json')
def installer_generate(openshift_release_image):
    logging.info("Installer generate ignitions")
    bip_env = {
        "OPENSHIFT_INSTALL_RELEASE_IMAGE":
        openshift_release_image,
        "OPENSHIFT_INSTALL_EXPERIMENTAL_BOOTSTRAP_IN_PLACE":
        "true",
        "OPENSHIFT_INSTALL_EXPERIMENTAL_BOOTSTRAP_IN_PLACE_COREOS_INSTALLER_ARGS":
        "/dev/vda"
    }
    utils.run_command_with_output(
        f"{INSTALLER_BINARY} create ignition-configs --dir={IBIP_DIR}",
        env=bip_env)