As you can see on the screen shot there is no error message, when the VM Deploy fails:
Example run with the fix when the provided token is not valid:
Even though we had the set +e the code in the if statement did not execute, because of the trap statement from above.
Here's what actually happended
If orka3 vm deploy fails, the script will not exit immediately due to set +e. Instead, it will continue to the next command.
However, before moving to the next command, the shell will first execute the function specified in your trap statement - system_failure, which will exit the scripts. That's why we were not seeing the error messages.
Now instead of handling the error, we can directly rely on the trap handler to execute if vm deploy fails.
As you can see on the screen shot there is no error message, when the VM Deploy fails:
Example run with the fix when the provided token is not valid:
Even though we had the
set +e
the code in the if statement did not execute, because of thetrap
statement from above.Here's what actually happended
If
orka3 vm deploy
fails, the script will not exit immediately due to set +e. Instead, it will continue to the next command. However, before moving to the next command, the shell will first execute the function specified in your trap statement -system_failure
, which will exit the scripts. That's why we were not seeing the error messages.Now instead of handling the error, we can directly rely on the trap handler to execute if
vm deploy
fails.