Bug 1917461
Summary: | etckeeper dnf plugin doesn't halt dnf on unclean /etc | ||
---|---|---|---|
Product: | [Fedora] Fedora EPEL | Reporter: | David Allsopp <David.Allsopp> |
Component: | etckeeper | Assignee: | Thomas Moschny <thomas.moschny> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | epel8 | CC: | gulikoza, thomas.moschny, uckelman |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | etckeeper-1.18.20-1.el8 etckeeper-1.18.20-1.el9 etckeeper-1.18.20-1.fc36 etckeeper-1.18.20-1.fc37 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2023-02-06 00:41:18 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
David Allsopp
2021-01-18 14:28:19 UTC
This happens on Fedora 34 as well. I'm not 100% certain, but I believe it did still work in Fedora 32. (I can check in a few days.) It's _extremely_ unpleasant to have an autocommit happen when you were expecting etckeeper to prevent autocommits. It seems that etckeeper-1.18.12-fix-output-for-ansible.patch removes raising the exception when commit should not happen and only prints logger warning. This patch restores upstream exception (and fixes changes being committed together with the updates): diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py --- a/etckeeper-dnf/etckeeper.py +++ b/etckeeper-dnf/etckeeper.py @@ -25,10 +25,8 @@ class Etckeeper(dnf.Plugin): ret = subprocess.call(("etckeeper", command), stdout=devnull, stderr=devnull, close_fds=True) - if ret > 0: - logger.warning('"etckeeper %s" failed (exit code %d)' % (command, ret)) - if ret < 0: - logger.warning('"etckeeper %s" died (signal %d)' % (command, -ret)) + if ret != 0: + raise dnf.exceptions.Error('"etckeeper %s" returned: %d' % (command, ret)) except OSError as err: logger.warning('Failed to run "etckeeper %s": %s' % (command, err)) Results: # dnf update Last metadata expiration check: 2:16:56 ago on Mon 21 Nov 2022 06:01:49 PM CET. Error: "etckeeper pre-install" returned: 1 The error message however could be improved further to indicate why it failed (as in EPEL 7). See http://etckeeper.branchable.com/todo/DNF:_fix_logging__44___so_it_will_work_from_Ansible/#comment-001e7df84c078099b13e9329de359c2b . Before applying the patch, output caused problems when DNF was used from Ansible. On the other hand, not all DNF versions seem to cancel the transaction when an exception is generated in the plugin's hook. It is not clear to me what the correct solution is. On which OS did you test your patch? Looking at bug 1701807, the corresponding patch https://github.com/rpm-software-management/dnf/pull/1383 seems to have been included in dnf-4.2.5, so is included in el 8.1 and later. So we could try your patch (i.e., partly reverting the etckeeper-1.18.12-fix-output-for-ansible.patch). FEDORA-EPEL-2022-b416abaa5f has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-b416abaa5f FEDORA-EPEL-2022-f6e51740fc has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-f6e51740fc FEDORA-2022-7d3ab5fc50 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-7d3ab5fc50 FEDORA-2022-0d644cc063 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-0d644cc063 FEDORA-2022-7d3ab5fc50 has been pushed to the Fedora 37 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-7d3ab5fc50` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-7d3ab5fc50 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2022-b416abaa5f has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-b416abaa5f See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2022-f6e51740fc has been pushed to the Fedora EPEL 9 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-f6e51740fc See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2022-0d644cc063 has been pushed to the Fedora 36 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-0d644cc063` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-0d644cc063 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. > On which OS did you test your patch?
I'm using el 8.6 or el 8.7.
I didn't see that initially dnf did not terminate after an exception, but I suppose this is now included after el 8.1
I haven't tested Ansible so I can't say if exception causes additional problems there.
FEDORA-EPEL-2023-892e5376ac has been pushed to the Fedora EPEL 9 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-892e5376ac See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2023-a427abed1e has been pushed to the Fedora 37 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a427abed1e` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a427abed1e See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2023-11e40b5991 has been pushed to the Fedora 36 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-11e40b5991` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-11e40b5991 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2023-8fe90c6cd1 has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-8fe90c6cd1 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2023-8fe90c6cd1 has been pushed to the Fedora EPEL 8 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-EPEL-2023-892e5376ac has been pushed to the Fedora EPEL 9 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2023-11e40b5991 has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2023-a427abed1e has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report. |