From af9f5bfbc7f349a5a90d14b7a2629708756589f0 Mon Sep 17 00:00:00 2001 From: Radek Vykydal Date: Mon, 13 Nov 2023 12:01:51 +0100 Subject: [PATCH] logging: split image package list message into 8K chunks rsyslogd has default of 8K for message to be passed. Fixup of commit 113226788499ee7848db551875ab293efd6b3b38. --- anaconda.py | 4 +++- pyanaconda/core/util.py | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/anaconda.py b/anaconda.py index 7bc7d20c482..b6eda7e54b1 100755 --- a/anaconda.py +++ b/anaconda.py @@ -227,7 +227,9 @@ 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()) + # Do not exceed default 8K limit on message length in rsyslog + for log_line in util.get_image_packages_info(max_string_chars=8096-100): + log.debug("Image packages: %s", log_line) if opts.updates_url: log.info("Using updates from: %s", opts.updates_url) diff --git a/pyanaconda/core/util.py b/pyanaconda/core/util.py index e477294a01d..8005a52eb3c 100644 --- a/pyanaconda/core/util.py +++ b/pyanaconda/core/util.py @@ -985,8 +985,20 @@ def restorecon(paths, root, skip_nonexistent=False): return True -def get_image_packages_info(): +def get_image_packages_info(max_string_chars=0): + """List of strings containing versions of installer image packages. + + The package version specifications are space separated in the strings. + + :param int max_string_chars: maximum number of character in a string + :return [str] + """ + info_lines = [] if os.path.exists(PACKAGES_LIST_FILE): - return ' '.join(line.strip() for line in open(PACKAGES_LIST_FILE).readlines()) - else: - return '' + with open(PACKAGES_LIST_FILE) as f: + while True: + lines = f.readlines(max_string_chars) + if not lines: + break + info_lines.append(' '.join(line.strip() for line in lines)) + return info_lines