-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way of creating and executing "config switch" operations #86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me for now
Thanks for checking :) Once #87 is merged, I'll rebase this branch on top of that. |
07fdc0d
to
abf19e3
Compare
Rebased on top of
I plan to rebase this branch on top of |
abf19e3
to
809f870
Compare
This commit is a WIP -- the final implementation in the ``pg-backup-api`` depends on the final implementation of the ``barman config switch`` command in Barman. Through this commit we create a draft for the future change in ``pg-backup-api``. Currently it is composed by the following changes: * Create a ``ConfigSwitchOperation`` class, which takes care of validating the arguments for a config switch operation, and also of running such operation; * Modify `servers_operations_post` Flask end point so it is able to receive POST requests both for creating a recovery operation or a config switch operation; * Create a new command ``pg-backup-api config-switch``, which is used by the API in order to run the config swith on Barman; * Create a function ``config_switch_operation``, which is used by ``pg-backup-api config-switch`` command; * Create a helper function ``_run_operation``, which is used both by ``recovery_operation`` and ``config_switch_operation`` functions. They both have a very similar logic, so that helper function executes the common code paths. References: BAR-125. Signed-off-by: Israel Barth Rubio <[email protected]>
This commit adds unit tests for the recently implemented ``ConfigSwitchOperation``. This is still a WIP because we need to know how the final implementation of ``barman config switch`` comand in Barman so we can then adjust the code and tests in pg-backup-api. References: BAR-125. Signed-off-by: Israel Barth Rubio <[email protected]>
809f870
to
bd0d1da
Compare
Rebased on top of |
After #87 has been merged into `main`, this dev branch for BAR-125 has been rebased on top of `main`. Given the improvements made to the unit test suite through #87, we are now adjusting the unit tests of this dev branch: * `test_server_operation.py` for `ConfigSwitchOperation` is now following the new design, which uses `pytest` and splits complex tests into several smaller ones; * add tests for "config switch operation" on unit test modules that where introduced by #87 (`test_main.py`, `test_run.py`, and `test_utility_controller.py`) Note: we are still missing the final design of the `barman config switch` implementation in Barman, so we keep this branch as a WIP. References: BAR-125. Signed-off-by: Israel Barth Rubio <[email protected]>
bd0d1da
to
39bed62
Compare
…fig-switch` Previous to this commit we had draft code and unit tests as we were still working on the implementation of `barman config-switch` command. Now that the design of `barman config-switch` is mature, we are adjusting this branch so it gets compliant with the expected implementation of that command. References: BAR-125. Signed-off-by: Israel Barth Rubio <[email protected]>
Through this PR we expose an operation in the REST API for performing
barman config-switch
command remotely. The following changes have been applied:ConfigSwitchOperation
class, which takes care of validating the arguments for a config switch operation, and also of running such operation;servers_operations_post
Flask end point so it is able to receive POST requests both for creating a recovery operation or a config switch operation;pg-backup-api config-switch
, which is used by the API in order to run the config switch on Barman;config_switch_operation
, which is used bypg-backup-api config-switch
command;_run_operation
, which is used both byrecovery_operation
andconfig_switch_operation
functions. They both have a very similar logic, so that helper function executes the common code paths.The new API endpoint is able to handle both an "apply model" or a "reset model" through
barman config-switch
command.References: BAR-125.