mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-08 14:23:11 +00:00
ipabackup: Fix order of ipabackup_name parameter evaluation.
When performing a backup with 'state:present', if 'ipabackup_name' is provided, the backup will be performed, but the role with return an error since 'ipabackup_name' should not be set for this state. This patch moves the parameter evaluation to be performed before the actual backup is performed, so that the backup is not performed and an error is reported.
This commit is contained in:
@@ -383,6 +383,31 @@
|
||||
loop_var: server_backup_data
|
||||
label: server_backup_data.path
|
||||
|
||||
# Test issue #900
|
||||
- name: Remove all backup from server.
|
||||
ansible.builtin.include_role:
|
||||
name: ipabackup
|
||||
vars:
|
||||
state: absent
|
||||
ipabackup_name: all
|
||||
|
||||
- name: Test issue 900 fix.
|
||||
block:
|
||||
- name: Invalid role configuration that should not produce a backup on the server.
|
||||
ansible.builtin.include_role:
|
||||
name: ipabackup
|
||||
vars:
|
||||
state: present
|
||||
ipabackup_name: this_must_fail
|
||||
rescue:
|
||||
- name: List all existing backups on server
|
||||
ansible.builtin.find:
|
||||
path: /var/lib/ipa/backup
|
||||
recurse: no
|
||||
file_type: directory
|
||||
register: server_backups
|
||||
failed_when: server_backups.files
|
||||
|
||||
# CLEANUP
|
||||
|
||||
- name: List all existing backups on controller
|
||||
|
||||
Reference in New Issue
Block a user