summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-02-05 15:27:52 -0800
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2021-03-04 15:53:10 +0530
commit572642291db33e455ebe451a0e2743e9fadb6e91 (patch)
treecc75db4648c0c485c4244b8abd16963f3bd50ea4
parent52e5accd057374f76dcca5d0cc8e51a98d1a3162 (diff)
downloadchef-572642291db33e455ebe451a0e2743e9fadb6e91.tar.gz
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 <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package/dnf/dnf_helper.py4
-rw-r--r--lib/chef/provider/package/yum/yum_helper.py4
2 files changed, 8 insertions, 0 deletions
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: