engine: resources: Fix missing file when specified without content

If the file res was defined with state => "exists" but no content
specified, it was not created. This patch fixes this bug and adds a test
and an example.
This commit is contained in:
James Shubin
2019-03-05 11:51:04 -05:00
parent 11fc55d679
commit 426b15313e
3 changed files with 107 additions and 2 deletions

View File

@@ -4,11 +4,16 @@ exec "exec1" {
args => ["-c", "print(\"i'm in python!\")",],
}
file "/tmp/whatever" {
state => "exists",
}
exec "exec2" {
cmd => "echo hello world > /tmp/whatever",
shell => "/bin/bash",
ifcmd => "! diff <(cat /tmp/whatever) <(echo hello world)",
ifshell => "/bin/bash",
watchcmd => "touch /tmp/whatever && /usr/bin/inotifywait -e modify -m /tmp/whatever",
watchshell => "/bin/bash",
watchcmd => "/usr/bin/inotifywait -e modify -m /tmp/whatever",
Depend => File["/tmp/whatever"], # so that inotifywait can startup
}