I have a helper function:
function error_exit
{
/opt/aws/bin/cfn-signal ...
exit 1
}
This helper function is used to signal an error. Here is an example of usage:
/opt/aws/bin/cfn-init -s .. || error_exit 'Failed to run cfn-init'
The cfn-init
command takes a lot of parameters which isn't relevant for the question. When the command returns a non-null value and possibly an error message to the error output, I would like to get the error message and include it to the error_exit
method as a parameter. Is this possible? If not, how would you implement a helper method in bash which makes it possible to get the source error message?
--disable-rollback
in the CLI tools. Also usecfn-init
's-v
flag to get verbose output.