Skip to content

Commit

Permalink
logging: split image package list message into 8K chunks
Browse files Browse the repository at this point in the history
rsyslogd has default of 8K for message to be passed.
Fixup of commit 1132267.
  • Loading branch information
rvykydal committed Nov 13, 2023
1 parent 9998c42 commit af9f5bf
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 af9f5bf

Please sign in to comment.