Bypass sync error#163
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a SYNC_ERROR_BYPASS configuration option that allows the script to proceed even if the SnapRAID array was not fully synced. The reviewer suggested improving the robustness of the variable check by providing a default value and adding console output to inform interactive users when the bypass is triggered.
| if [ "$SYNC_ERROR_BYPASS" -eq 1 ]; then | ||
| mklog "WARN: Previous sync did not complete successfully, proceeding anyway." | ||
| SNAPRAID_STATUS=0 | ||
| else | ||
| mklog "WARN: The array is NOT fully synced. Stopping the script." | ||
| SNAPRAID_STATUS=1 | ||
| fi |
There was a problem hiding this comment.
When SYNC_ERROR_BYPASS is enabled, the script proceeds despite the array not being fully synced. This event is currently only logged to the log file and not displayed on the console, which can be confusing for users running the script interactively. Adding an echo statement ensures the user is informed of the bypass. Additionally, using ${SYNC_ERROR_BYPASS:-0} provides robustness against cases where the variable might be unset or empty in the configuration file.
| if [ "$SYNC_ERROR_BYPASS" -eq 1 ]; then | |
| mklog "WARN: Previous sync did not complete successfully, proceeding anyway." | |
| SNAPRAID_STATUS=0 | |
| else | |
| mklog "WARN: The array is NOT fully synced. Stopping the script." | |
| SNAPRAID_STATUS=1 | |
| fi | |
| if [ "${SYNC_ERROR_BYPASS:-0}" -eq 1 ]; then | |
| echo "Previous sync did not complete successfully, proceeding anyway." | |
| mklog "WARN: Previous sync did not complete successfully, proceeding anyway." | |
| SNAPRAID_STATUS=0 | |
| else | |
| mklog "WARN: The array is NOT fully synced. Stopping the script." | |
| SNAPRAID_STATUS=1 | |
| fi |
Added logging to console and default condition for an unset variable
Description
I was having many stoppages due to the array not being fully synced so I added an option to bypass the warning while still logging the status.
Type of change
Checklist: