Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
DNF: fix logging, now it will work from Ansible
The Ansible dnf module uses the python dnf bindings. In contexts like these, stdout/stderr is owned by the host app (Ansible). dnf should not mess with stdout/stderr, unless the host app asks it to log there. Specifically, it was breaking the JSON output of the Ansible module. This was only noticeable when the etckeeper message began with a "[" character. Ansible has a mechanism to try and skip header messages like login banners. However, "[" is a valid character to start a JSON document. https://unix.stackexchange.com/questions/511210/ansible-dnf-module-module-failure/ This requires decoding the etckeeper messages into unicode. For gory details, see the code comment. Also enable unicode string literals. This reduces differences between py2 and py3 semantics; it is universal inside the dnf code. Also when I tested the failure case, I noticed the exit code was not printed correctly. Fix it.
- Loading branch information
afbdce2There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref: ansible/ansible#54949 (comment)