Repository navigation
fix: dhis2-restoredb precheck target DB and idempotent container stop/start - #106
Merged
Merged
Conversation
…/start
Two bugs in the restore scripts (pre-install/files/dhis2-restoredb,
mirrored in backups/files/ssh/dhis2-restoredb):
1. The pre-check query didn't target the "postgres" maintenance
database, causing false failures before the restore even started.
2. The container stop/start step (added so nothing holds open
connections during restore) unconditionally called `lxc stop`,
which errored ("The instance is already stopped") if the DHIS2
instance container was already stopped, aborting the whole
restore. Fixed by checking the container's actual state via
`lxc list --format csv -c s` first, and only stopping (and
trap-restarting) it if it was actually running - otherwise leaving
it as-is.
Also removes backups/files/dhis2-restoredb, an orphaned duplicate of
the same script with neither fix applied and no remaining references
in the backups role's tasks.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
postgresmaintenance database, causing false failures before the restore even started.lxc stop, which errored ("The instance is already stopped") if the DHIS2 instance container was already stopped, aborting the whole restore. Fixed by checking the container's actual state vialxc list --format csv -c sfirst, and only stopping (and trap-restarting) it if it was actually running.backups/files/dhis2-restoredb, an orphaned duplicate of the same script with neither fix applied and no remaining references in the backups role's tasks.Test plan
dhis2-restoredbagainst a running instance container - confirm it stops the container, restores, and restarts itdhis2-restoredbagainst an already-stopped instance container - confirm it no longer errors out and completes the restore