mirror of
https://github.com/ansible/ansible
synced 2026-06-19 07:35:52 +00:00
dnf: add test for broken config file (#86901)
Fixes: #85681 Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user