Skip to content

Commit 1c1cce6

Browse files
authored
Merge pull request #5314 from rvykydal/fix-packages-logging
logging: split image package list message into 8K chunks
2 parents c25d1fe + af9f5bf commit 1c1cce6

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

anaconda.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ def setup_environment():
227227
sys.exit(0)
228228

229229
log.info("%s %s", sys.argv[0], util.get_anaconda_version_string(build_time_version=True))
230-
log.debug("Image packages list: %s", util.get_image_packages_info())
230+
# Do not exceed default 8K limit on message length in rsyslog
231+
for log_line in util.get_image_packages_info(max_string_chars=8096-100):
232+
log.debug("Image packages: %s", log_line)
231233

232234
if opts.updates_url:
233235
log.info("Using updates from: %s", opts.updates_url)

pyanaconda/core/util.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,20 @@ def restorecon(paths, root, skip_nonexistent=False):
985985
return True
986986

987987

988-
def get_image_packages_info():
988+
def get_image_packages_info(max_string_chars=0):
989+
"""List of strings containing versions of installer image packages.
990+
991+
The package version specifications are space separated in the strings.
992+
993+
:param int max_string_chars: maximum number of character in a string
994+
:return [str]
995+
"""
996+
info_lines = []
989997
if os.path.exists(PACKAGES_LIST_FILE):
990-
return ' '.join(line.strip() for line in open(PACKAGES_LIST_FILE).readlines())
991-
else:
992-
return ''
998+
with open(PACKAGES_LIST_FILE) as f:
999+
while True:
1000+
lines = f.readlines(max_string_chars)
1001+
if not lines:
1002+
break
1003+
info_lines.append(' '.join(line.strip() for line in lines))
1004+
return info_lines

0 commit comments

Comments
 (0)