def log_collection(vm_ip): etype, _value, _tb = sys.exc_info() logging.info( f"Collecting logs after a {('failed', 'successful')[etype is None]} installation" ) try: logging.info("Gathering sosreport data from host...") gather_sosreport_data(output_dir=IBIP_DIR, private_ssh_key_path=SSH_KEY) except Exception: logging.exception("sosreport gathering failed!") utils.retry() try: logging.info("Gathering information via installer-gather...") utils.recreate_folder(INSTALLER_GATHER_DIR, force_recreate=True) installer_gather(ip=vm_ip, ssh_key=SSH_KEY, out_dir=INSTALLER_GATHER_DIR) except Exception: logging.exception("installer-gather failed!") try: logging.info("Gathering information via must-gather...") utils.recreate_folder(MUST_GATHER_DIR) download_must_gather(KUBE_CONFIG, MUST_GATHER_DIR) except Exception: logging.exception("must-gather failed!")
def waiting_for_installation_completion(controller): vm_ip = controller.master_ips[0][0] try: logging.info("Configuring /etc/hosts...") utils.config_etc_hosts(cluster_name=controller.cluster_name, base_dns_domain=controller.cluster_domain, api_vip=vm_ip) logging.info("Waiting for installation to complete...") waiting.wait(all_operators_up, sleep_seconds=20, timeout_seconds=60 * 60, waiting_for="all operators to get up") logging.info("Installation completed successfully!") finally: logging.info("Gathering sosreport data from host...") node = Nodes(controller, private_ssh_key_path=SSH_KEY)[0] gather_sosreport_data(node) logging.info("Gathering information via installer-gather...") utils.recreate_folder(INSTALLER_GATHER_DIR, force_recreate=True) installer_gather(ip=vm_ip, ssh_key=SSH_KEY, out_dir=INSTALLER_GATHER_DIR) logging.info("Gathering information via must-gather...") utils.recreate_folder(MUST_GATHER_DIR) download_must_gather(KUBE_CONFIG, MUST_GATHER_DIR)