Beaker doesn't provide any mechanism for passing arbitrary data between recipes in a recipe set. There is only rhts-sync-set/rhts-sync-block for synchronization.
However you can still (ab)use those to achieve what you want. The trick is to use two separate sync states. Let's call them CMD_SUCCEEDED
and CMD_FAILED
(use more specific names if you want).
The first recipe sets CMD_SUCCEEDED
if the command succeeded or CMD_FAILED
if the command failed.
do_something_important
if [ $? -eq 0 ] ; then
rhts-sync-set -s CMD_SUCCEEDED
else
rhts-sync-set -s CMD_FAILED
fi
Then your other recipe can wait on either state (by passing two -s
options) and then test which one was reached (by passing --timeout 0
):
rhts-sync-block -s CMD_SUCCEEDED -s CMD_FAILED $CLIENTS
if rhts-sync-block -s CMD_SUCCEEDED --timeout 0 $CLIENTS ; then
# command succeeded
else
# command failed
fi
(This idea was originally suggested by Nick Coghlan.)