From 113226788499ee7848db551875ab293efd6b3b38 Mon Sep 17 00:00:00 2001 From: Radek Vykydal Date: Thu, 21 Sep 2023 16:14:50 +0200 Subject: [PATCH] logging: log content of /root/lorax-packages if available It is way easier to have package versions in logs then try to gather the file additionally (or make sure it is among the logs collected by automation). One of concrete applications is kickstart-tests. They forward the log from the virtual machine and in case of installation not finishing we don't have the data because the log files are not copied to target system from where we gather the logs. --- anaconda.py | 1 + pyanaconda/core/constants.py | 2 ++ pyanaconda/core/util.py | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/anaconda.py b/anaconda.py index b2df895be6d..684f170dfc2 100755 --- a/anaconda.py +++ b/anaconda.py @@ -226,6 +226,7 @@ def setup_environment(): sys.exit(0) log.info("%s %s", sys.argv[0], util.get_anaconda_version_string(build_time_version=True)) + log.debug("Image packages list: %s", util.get_image_packages_info()) if opts.updates_url: log.info("Using updates from: %s", opts.updates_url) diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py index 84b5805ac9b..dbdc6f4f510 100644 --- a/pyanaconda/core/constants.py +++ b/pyanaconda/core/constants.py @@ -242,6 +242,8 @@ class SecretStatus(Enum): # screenshots SCREENSHOTS_DIRECTORY = "/tmp/anaconda-screenshots" +PACKAGES_LIST_FILE = "/root/lorax-packages.log" + CMDLINE_FILES = [ "/proc/cmdline", "/run/install/cmdline", diff --git a/pyanaconda/core/util.py b/pyanaconda/core/util.py index 51bac510b22..8fd5235e29d 100644 --- a/pyanaconda/core/util.py +++ b/pyanaconda/core/util.py @@ -40,7 +40,7 @@ from pyanaconda.core.path import make_directories, open_with_perm, join_paths from pyanaconda.core.process_watchers import WatchProcesses from pyanaconda.core.constants import DRACUT_SHUTDOWN_EJECT, \ - IPMI_ABORTED, X_TIMEOUT + IPMI_ABORTED, X_TIMEOUT, PACKAGES_LIST_FILE from pyanaconda.core.live_user import get_live_user from pyanaconda.errors import RemovedModuleError @@ -972,3 +972,10 @@ def restorecon(paths, root, skip_nonexistent=False): return False else: return True + + +def get_image_packages_info(): + if os.path.exists(PACKAGES_LIST_FILE): + return ' '.join(line.strip() for line in open(PACKAGES_LIST_FILE).readlines()) + else: + return ''