diff options
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/subplot.py | 18 | ||||
-rw-r--r-- | subplot/subplot.yaml | 9 |
2 files changed, 25 insertions, 2 deletions
diff --git a/subplot/subplot.py b/subplot/subplot.py index 596e8dd..537c353 100644 --- a/subplot/subplot.py +++ b/subplot/subplot.py @@ -84,9 +84,8 @@ def set_vars_file(ctx, filename=None): f.write(data) -def run_playbook(ctx): +def try_playbook(ctx): runcmd = globals()["runcmd"] - exit_code_zero = globals()["exit_code_zero"] assert_ne = globals()["assert_ne"] srcdir = globals()["srcdir"] @@ -128,4 +127,19 @@ def run_playbook(ctx): ] runcmd(ctx, argv, env=env) + + +def command_fails(ctx): + exit_code_nonzero = globals()["exit_code_nonzero"] + exit_code_nonzero(ctx) + + +def run_playbook(ctx): + exit_code_zero = globals()["exit_code_zero"] + try_playbook(ctx) exit_code_zero(ctx) + + +def xstdout_contains(ctx, text=None): + stdout_contains = globals()["stdout_contains"] + stdout_contains(ctx, pattern=text) diff --git a/subplot/subplot.yaml b/subplot/subplot.yaml index 01c85f5..5993feb 100644 --- a/subplot/subplot.yaml +++ b/subplot/subplot.yaml @@ -13,3 +13,12 @@ - when: I run the playbook function: run_playbook + +- when: I try to run the playbook + function: try_playbook + +- then: the command fails + function: command_fails + +- then: stdout contains "{text:text}" + function: xstdout_contains |