dnf: add test for broken config file (#86901)

Fixes: #85681

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
pull/86944/head
Abhijeet Kasurde 2 weeks ago committed by GitHub
parent ef4cb719c7
commit 6ffe277fbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,30 @@
---
- name: Create a broken dnf config file
copy:
content: '[broken_section\nname=value'
dest: '{{ remote_tmp_dir }}/broken.conf'
register: broken_conf
- name: Use broken conf file
dnf:
name: bash
state: present
conf_file: '{{ broken_conf.dest }}'
register: dnf_bash_result
ignore_errors: true
- name: Verify that broken conf raises an error
assert:
that:
- "dnf_bash_result is failed"
- "'Error in configuration file' in dnf_bash_result.msg"
when: ansible_facts['distribution'] == 'Fedora'
- name: Verify that broken conf raises an error on RHEL
assert:
that:
- "dnf_bash_result is failed"
- "'Parsing file' in dnf_bash_result.msg"
when:
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] in (9, 10)

@ -43,6 +43,7 @@
- include_tasks: logging.yml
- include_tasks: cacheonly.yml
- include_tasks: multilib.yml
- include_tasks: dnf_config.yml
# Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta)
- include_tasks: dnfreleasever.yml

Loading…
Cancel
Save