From dccabff4042ca8d556f6f56f6ae87da6265150bf Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 5 Feb 2021 15:27:52 -0800 Subject: DNF package: fix abrt errors For people with ABRT logging every exit of chef-client would have ABRT errors due to readline returning '' for EOF and then the JSON parsing throwing. This causes it to exit gracefully. AFAIK there was actually no impact to this bug and chef was behaving entirely correctly in terms of doing its job, but the python helper was shutting down uncleanly. Signed-off-by: Lamont Granquist --- lib/chef/provider/package/dnf/dnf_helper.py | 4 ++++ lib/chef/provider/package/yum/yum_helper.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/chef/provider/package/dnf/dnf_helper.py b/lib/chef/provider/package/dnf/dnf_helper.py index 325ce14041..302bcd9562 100644 --- a/lib/chef/provider/package/dnf/dnf_helper.py +++ b/lib/chef/provider/package/dnf/dnf_helper.py @@ -168,6 +168,10 @@ try: setup_exit_handler() line = inpipe.readline() + # only way to detect EOF in python + if line == "": + break + try: command = json.loads(line) except ValueError: diff --git a/lib/chef/provider/package/yum/yum_helper.py b/lib/chef/provider/package/yum/yum_helper.py index 47cbe2efe6..465dceab18 100644 --- a/lib/chef/provider/package/yum/yum_helper.py +++ b/lib/chef/provider/package/yum/yum_helper.py @@ -196,6 +196,10 @@ try: setup_exit_handler() line = inpipe.readline() + # only way to detect EOF in python + if line == "": + break + try: command = json.loads(line) except ValueError, e: -- cgit v1.2.1