better output and examples

This commit is contained in:
Nadja Reitzenstein 2021-09-21 09:22:54 +02:00
parent aa58657122
commit 04052b6193
4 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Bash actor called with $@" echo "Bash actor called with $@" > /tmp/act
echo "Bash actor called with: $@"

View File

@ -1,13 +1,14 @@
-- { actor_connections = [] : List { _1 : Text, _2 : Text } -- { actor_connections = [] : List { _1 : Text, _2 : Text }
{ actor_connections = { actor_connections =
-- Link up machines to actors
[ { _1 = "Testmachine", _2 = "Actor" } [ { _1 = "Testmachine", _2 = "Actor" }
, { _1 = "Another", _2 = "Bash" } , { _1 = "Another", _2 = "Bash" }
-- One machine can have as many actors as it wants
, { _1 = "Yetmore", _2 = "Bash2" } , { _1 = "Yetmore", _2 = "Bash2" }
, { _1 = "Yetmore", _2 = "FailBash"}
] ]
, actors = , actors =
{ Actor = { module = "Dummy", params = {=} } { Actor = { module = "Dummy", params = {=} }
, Actor2 = { module = "Dummy", params = {=} }
, Actor3 = { module = "Dummy", params = {=} }
, Bash = { module = "Process", params = , Bash = { module = "Process", params =
{ cmd = "./examples/actor.sh" { cmd = "./examples/actor.sh"
, args = "your ad could be here" , args = "your ad could be here"
@ -16,8 +17,8 @@
{ cmd = "./examples/actor.sh" { cmd = "./examples/actor.sh"
, args = "this is a different one" , args = "this is a different one"
}} }}
, Bash3 = { module = "Process", params = , FailBash = { module = "Process", params =
{ cmd = "./examples/actor.sh" { cmd = "./examples/fail-actor.sh"
}} }}
} }
, init_connections = [] : List { _1 : Text, _2 : Text } , init_connections = [] : List { _1 : Text, _2 : Text }

4
examples/fail-actor.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
echo "This is some error output" > /dev/stderr
exit 115

View File

@ -78,7 +78,7 @@ impl Actuator for Process {
} }
} }
Ok(retv) => { Ok(retv) => {
warn!(flog, "Actor {} returned nonzero output {} for {:?}", name, retv.status, fstate); warn!(flog, "Actor {} returned nonzero status {} for State={:?}", name, retv.status, fstate);
if !retv.stderr.is_empty() { if !retv.stderr.is_empty() {
let errstr = String::from_utf8_lossy(&retv.stderr); let errstr = String::from_utf8_lossy(&retv.stderr);
for line in errstr.lines() { for line in errstr.lines() {