mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-05-21 23:06:42 +00:00
`bash -E` causes inheritance of the ERR trap into shell functions, command substitutions, and commands executed in a subshell environment. Because the `kubectl_retry` function depends on detection an error of a subshell, the ERR trap is not needed to be executed. The trap contains extra logging, and exits the script in the `rook.sh` case. The aborting of the script is not wanted when a retry is expected to be done. While checking for known failures, the `grep` command may exit with 1, if there are no matches. That means, the `ret` variable will be set to 0, but there will also be an error exit status. This causes `bash -E` to abort the function, and call the ERR trap. Signed-off-by: Niels de Vos <ndevos@redhat.com> (cherry picked from commit 4891e534d33b373aa63922e54e51a803b6fb2a74)