Skip to content

Bypass sync error#163

Open
tehniemer wants to merge 3 commits intoauanasgheps:devfrom
tehniemer:sync_warning_bypass
Open

Bypass sync error#163
tehniemer wants to merge 3 commits intoauanasgheps:devfrom
tehniemer:sync_warning_bypass

Conversation

@tehniemer
Copy link
Copy Markdown
Contributor

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

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code (only required for new or big features)
  • My changes generate no new warnings

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread snapraid-aio-script.sh Outdated
Comment on lines +1432 to +1438
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant