Skip to content

Commit 47b673d

Browse files
committed
refactor: move badfish parameter validation to validate-vars role
Move the badfish parameter validation task from badfish/tasks/call.yml to validate-vars/tasks/badfish_call.yml to centralize validation logic in the validate-vars role. Changes: - Create validate-vars/tasks/badfish_call.yml with badfish parameter validation (badfish_host, badfish_user, badfish_password, badfish_args) - Update badfish/tasks/call.yml to include validation via include_role - Rename "Build badfish container command" task to "Build badfish command" Signed-off-by: Cédric Jeanneret <cjeanner@redhat.com>
1 parent 7c9ec9c commit 47b673d

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

ansible/roles/badfish/tasks/call.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@
1515
# retries: Number of retries (default: omit)
1616

1717
- name: Validate required badfish parameters
18-
ansible.builtin.assert:
19-
that:
20-
- badfish_host is defined
21-
- badfish_host | length > 0
22-
- badfish_user is defined
23-
- badfish_user | length > 0
24-
- badfish_password is defined
25-
- badfish_password | length > 0
26-
- badfish_args is defined
27-
- badfish_args | length > 0
28-
fail_msg: "Missing or empty required badfish parameters. Required: badfish_host, badfish_user, badfish_password, badfish_args"
29-
quiet: true
18+
ansible.builtin.include_role:
19+
name: validate-vars
20+
tasks_from: badfish_call
3021

31-
- name: Build and run badfish container command
22+
- name: Build badfish command
3223
vars:
3324
_badfish_podman_cmd: >-
3425
{{
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
# Validate required badfish parameters for badfish call tasks
3+
4+
- name: Validate required badfish parameters
5+
ansible.builtin.assert:
6+
that:
7+
- badfish_host is defined
8+
- badfish_host | length > 0
9+
- badfish_user is defined
10+
- badfish_user | length > 0
11+
- badfish_password is defined
12+
- badfish_password | length > 0
13+
- badfish_args is defined
14+
- badfish_args | length > 0
15+
fail_msg: "Missing or empty required badfish parameters. Required: badfish_host, badfish_user, badfish_password, badfish_args"
16+
quiet: true
17+

0 commit comments

Comments
 (0)