run-test-command: support list in test_command variable
This change enable run-test-command to use a list of commands. Change-Id: I7727c8330593a548a1bc66765bc632abfb9df1c8
This commit is contained in:
parent
89e386449d
commit
1475af7158
@ -1,7 +1,18 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Convert test_command to list
|
||||||
|
set_fact:
|
||||||
|
test_commands: ['{{ test_command }}']
|
||||||
|
when: test_command | type_debug != 'list'
|
||||||
|
|
||||||
|
- name: Use test_command list
|
||||||
|
set_fact:
|
||||||
|
test_commands: '{{ test_command }}'
|
||||||
|
when: test_command | type_debug == 'list'
|
||||||
|
|
||||||
- name: Run test_command
|
- name: Run test_command
|
||||||
command: '{{ test_command }}'
|
command: '{{ item }}'
|
||||||
args:
|
args:
|
||||||
chdir: '{{ zuul.project.src_dir }}'
|
chdir: '{{ zuul.project.src_dir }}'
|
||||||
|
with_items: '{{ test_commands }}'
|
||||||
|
@ -481,7 +481,9 @@
|
|||||||
description: |
|
description: |
|
||||||
Run simple command as test.
|
Run simple command as test.
|
||||||
|
|
||||||
To use this, set the ``test_command`` variable.
|
To use this, set the ``test_command`` variable to a single command or
|
||||||
|
a list of commands. For complex list of commands, it is recommended to
|
||||||
|
use a single command that run a proper script.
|
||||||
run: playbooks/run-test-command/run.yaml
|
run: playbooks/run-test-command/run.yaml
|
||||||
vars:
|
vars:
|
||||||
test_command: "exit 1"
|
test_command: "exit 1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user