Hi Blando,
There is no way to do a force continuation to the next iteration (when one has failed due to some reason) other than command manipulation in WFA.
You can manipulate your command in interest, using the below APIs
- getWfaWorkflowParameter
- addWfaWorkflowParameter
Do not write flat eval/catch code rather use the output from the above APIs.
use strict;
use .....
my $Cluster;
my .......
my $ErrorIfUnsuccessful = 'true';
my $SkipIfPreviousError = 'false';
my $lunPreviousErrorCode = "0";
my $lunPreviousErrorReason;
GetOptions(
"Cluster=s" => \$Cluster,
......
) or die 'Illegal command parameters';
my $wfa_util = WFAUtil->new();
if ($SkipIfPreviousError eq 'true') {
$lunPreviousErrorCode = $wfa_util->getWfaWorkflowParameter('lun_previous_error_code');
}
if ($lunPreviousErrorCode ne "0") {
$wfa_util->sendLog('INFO', "Changing state of LUN $LunName has been skipped due to unsuccessful completion of previous step(s)");
$lunPreviousErrorReason = $wfa_util->getWfaWorkflowParameter('lun_previous_error_reason');
$wfa_util->sendLog('INFO', "Estimated previous error: $lunPreviousErrorReason");
}
else {
eval {
$wfa_util->sendLog('INFO', 'Connecting to cluster: ' . $Cluster);
# DO SOMETHING ......
$wfa_util->addWfaWorkflowParameter('lun_previous_error_code', 0, 0);
};
if ($ErrorIfUnsuccessful eq 'true') {
$wfa_util->checkEvalFailure("Failed to change state (to $ChangeState) for LUN '$LunName'", $@);
}
else {
if ($@) {
my ($error_reason, $error_code) = $wfa_util->getEvalErrorReasonAndCode($@);
$wfa_util->sendLog('ERROR', "Failed to change state (to $ChangeState) for LUN '$LunName': $error_reason ($error_code)");
$wfa_util->addWfaWorkflowParameter('lun_previous_error_code', $error_code, 0);
$wfa_util->addWfaWorkflowParameter('lun_previous_error_reason', $error_reason, 0);
}
}
}
This is an example of manupulation of code of our interest. This will also do skipping of further steps in one iteration upon failure in one step. At the same time you need to control the command instance in an intelegent way as well.
You can refer to the pack “Foreign LUN Import” from the store.
Thanks,
Gaurab