diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-11-01 10:05:10 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-11-01 10:05:10 +0200 |
commit | 10b9715cb64f09dbf903b686002824e2107d3fd5 (patch) | |
tree | f3ebb1e4dacb00ab10a2a8bb62909dd74818b10f /subplot | |
parent | 32ab130707616ed01aed81e8b10dc63f445d2278 (diff) | |
download | debian-ansible-10b9715cb64f09dbf903b686002824e2107d3fd5.tar.gz |
sane_debian_system: check that debian_codename is set
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 |