Skip to content

Commit

Permalink
Merge pull request #5314 from rvykydal/fix-packages-logging
Browse files Browse the repository at this point in the history
logging: split image package list message into 8K chunks
  • Loading branch information
rvykydal authored Nov 15, 2023
2 parents c25d1fe + af9f5bf commit 1c1cce6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 3 additions & 1 deletion anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 16 additions & 4 deletions pyanaconda/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1c1cce6

Please sign in to comment.