forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable logging using setup_loggers() API in dnf-4.2.17-6 or later
- Fixed issue ansible#28061 - https://bugzilla.redhat.com/show_bug.cgi?id=1788212 Signed-off-by: Hideki Saito <[email protected]>
- Loading branch information
1 parent
b1b79be
commit 79ab798
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- dnf - enable logging using setup_loggers() API in dnf-4.2.17-6 or later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Verify logging function is enabled in the dnf module. | ||
# The following tasks has been supported in dnf-4.2.17-6 or later | ||
# Note: https://bugzilla.redhat.com/show_bug.cgi?id=1788212 | ||
- name: Install latest version python3-dnf | ||
dnf: | ||
name: python3-dnf | ||
state: latest | ||
register: dnf_result | ||
|
||
- name: Verify python3-dnf installed | ||
assert: | ||
that: | ||
- "dnf_result.rc == 0" | ||
|
||
- name: Get python3-dnf version | ||
shell: "dnf info python3-dnf | awk '/^Version/ { print $3 }'" | ||
register: py3_dnf_version | ||
|
||
- name: Check logging enabled | ||
block: | ||
- name: remove logfiles if exist | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
loop: "{{ dnf_log_files }}" | ||
|
||
- name: Install sos package | ||
dnf: | ||
name: sos | ||
state: present | ||
register: dnf_result | ||
|
||
- name: Get status of logfiles | ||
stat: | ||
path: "{{ item }}" | ||
loop: "{{ dnf_log_files }}" | ||
register: stats | ||
|
||
- name: Verify logfile exists | ||
assert: | ||
that: | ||
- "item.stat.exists" | ||
loop: "{{ stats.results }}" | ||
when: | ||
- 'py3_dnf_version.stdout is version("4.2.17", ">=")' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dnf_log_files: | ||
- /var/log/dnf.log | ||
- /var/log/dnf.rpm.log | ||
- /var/log/dnf.librepo.log |