diff options
author | Hideki Saito <saito@fgrep.org> | 2020-05-13 14:27:58 +0200 |
---|---|---|
committer | Rick Elrod <rick@elrod.me> | 2020-05-31 03:37:27 +0200 |
commit | 79ab7984272120a5444bee9a0a1ea6e799789696 (patch) | |
tree | 45b8a00b1ea4c247889a7624a3c2575408c382c6 /test | |
parent | Fix return value interpretation of PluginLoader.find_plugin_with_context(). (... (diff) | |
download | ansible-79ab7984272120a5444bee9a0a1ea6e799789696.tar.xz ansible-79ab7984272120a5444bee9a0a1ea6e799789696.zip |
Enable logging using setup_loggers() API in dnf-4.2.17-6 or later
- Fixed issue #28061
- https://bugzilla.redhat.com/show_bug.cgi?id=1788212
Signed-off-by: Hideki Saito <saito@fgrep.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/dnf/tasks/logging.yml | 45 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/main.yml | 4 | ||||
-rw-r--r-- | test/integration/targets/dnf/vars/main.yml | 4 |
3 files changed, 53 insertions, 0 deletions
diff --git a/test/integration/targets/dnf/tasks/logging.yml b/test/integration/targets/dnf/tasks/logging.yml new file mode 100644 index 0000000000..ad4df72d6d --- /dev/null +++ b/test/integration/targets/dnf/tasks/logging.yml @@ -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", ">=")' diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml index 9369b5b0cd..0588118403 100644 --- a/test/integration/targets/dnf/tasks/main.yml +++ b/test/integration/targets/dnf/tasks/main.yml @@ -40,3 +40,7 @@ - include_tasks: modularity.yml when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('29', '>=')) or (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) + +- include_tasks: logging.yml + when: (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('31', '>=')) or + (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) diff --git a/test/integration/targets/dnf/vars/main.yml b/test/integration/targets/dnf/vars/main.yml new file mode 100644 index 0000000000..86588de335 --- /dev/null +++ b/test/integration/targets/dnf/vars/main.yml @@ -0,0 +1,4 @@ +dnf_log_files: + - /var/log/dnf.log + - /var/log/dnf.rpm.log + - /var/log/dnf.librepo.log |