diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-03-10 19:13:54 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-03-10 19:13:54 +0200 |
commit | 8f50c63e5bd161b7a5e641a06fac72e5bdf0b860 (patch) | |
tree | 8b0909a3f60e261c23319b42557649b78954817d | |
parent | f0b83e3125066c660b0f835f94576c072129adca (diff) | |
download | vmdb2-8f50c63e5bd161b7a5e641a06fac72e5bdf0b860.tar.gz |
Add scenario that uses Jinja2 templating
-rw-r--r-- | yarns/100-mvp.yarn | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/yarns/100-mvp.yarn b/yarns/100-mvp.yarn index d2e2399..a3e3040 100644 --- a/yarns/100-mvp.yarn +++ b/yarns/100-mvp.yarn @@ -113,6 +113,28 @@ the step mounts a filesystem, the teardown would unmount it. AND stdout contains "bar_teardown" followed by "foo_teardown" +Jinja2 templating in specification file values +============================================================================= + +Vmdb2 allows values in specification files to be processed by the +Jinja2 templating engine. This allows users to do thing such as write +specifications that use configuration values to determine what +happens. For our simple echo/error steps, we will write a rule that +outputs the image file name given by the user. A more realistic +specification file would instead do thing like create the file. + + SCENARIO jinja2 templating + GIVEN a specification file called j2.vmdb containing + ... { + ... steps: [ + ... { echo: "image is {{ image }}" }, + ... ] + ... } + WHEN user runs vmdb2 --image=foo.img j2.vmdb + THEN exit code is 0 + AND stdout contains "image is foo.img" followed by "bar" + + Error handling ============================================================================= |