From 10b9715cb64f09dbf903b686002824e2107d3fd5 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 1 Nov 2020 10:05:10 +0200 Subject: sane_debian_system: check that debian_codename is set --- subplot/subplot.py | 18 ++++++++++++++++-- subplot/subplot.yaml | 9 +++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'subplot') 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 -- cgit v1.2.1