fix: move quoting logic for pgbackrest #228
Merged
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
Replaces custom quoting logic with the shellescape library and moves it to only affect the Patroni bootstrap command.
Changes
Docker already escapes and quotes arguments, so the backup workflow breaks when we pre-quote those arguments. However, we still need the quoting when we build the bootstrap command in a Patroni config. Using a library for this handles more cases than just whitespace characters.
Testing
You can test this by adding
restore_optionsto thelocal-backup-and-restoreBruno scenario, e.g.:{ "restore_config": { "source_database_id": "storefront", "source_node_name": "n1", "source_database_name": "storefront", "repository": { "id": "{{repository_id}}", "type": "posix", "base_path": "/backups" }, "restore_options": { "type": "time", "target": "2025-12-19 13:27:12+00" } } }Note that when testing the restore functionality, you should use a timestamp after the end of the most recent full backup. When testing the create from backup functionality, you should just the beginning timestamp for your backup set. You can inspect your backup sets by running
pgbackrest infoinside the container, e.g.:PLAT-365