From b5420d0c9059e8abe5001b8dfb46536787acd858 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 6 Oct 2023 14:47:52 +0200 Subject: [PATCH] deprecate snapshot backups --- .../snapshot/snapshot_deprecation_message.rb | 14 ++++++++++++++ definitions/scenarios/backup.rb | 7 +++++++ lib/foreman_maintain/cli/backup_command.rb | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb diff --git a/definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb b/definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb new file mode 100644 index 000000000..10a062bf2 --- /dev/null +++ b/definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb @@ -0,0 +1,14 @@ +module Procedures::Backup + module Snapshot + class SnapshotDeprecationMessage < ForemanMaintain::Procedure + metadata do + description 'Snapshot backups are deprecated' + tags :backup + end + + def run + set_warn('Snapshot backups are deprecated and will be removed in a future version.') + end + end + end +end diff --git a/definitions/scenarios/backup.rb b/definitions/scenarios/backup.rb index 4fc891462..a5c417aff 100644 --- a/definitions/scenarios/backup.rb +++ b/definitions/scenarios/backup.rb @@ -21,6 +21,7 @@ class Backup < ForemanMaintain::Scenario def compose check_valid_startegy + snapshot_deprecation_warning safety_confirmation accessibility_confirmation prepare_directory @@ -110,6 +111,12 @@ def logical_volume_confirmation end end + def snapshot_deprecation_warning + if strategy == :snapshot + add_step_with_context(Procedures::Backup::Snapshot::SnapshotDeprecationMessage) + end + end + def accessibility_confirmation if [:offline, :snapshot].include?(strategy) add_step_with_context(Procedures::Backup::AccessibilityConfirmation) diff --git a/lib/foreman_maintain/cli/backup_command.rb b/lib/foreman_maintain/cli/backup_command.rb index 70214bdbe..8bc7e1e84 100644 --- a/lib/foreman_maintain/cli/backup_command.rb +++ b/lib/foreman_maintain/cli/backup_command.rb @@ -155,7 +155,7 @@ def execute class BackupCommand < Base subcommand 'online', 'Keep services online during backup', OnlineBackupCommand subcommand 'offline', 'Shut down services to preserve consistent backup', OfflineBackupCommand - subcommand 'snapshot', 'Use snapshots of the databases to create backup', SnapshotBackupCommand + subcommand 'snapshot', 'Use snapshots of the databases to create backup (DEPRECATED)', SnapshotBackupCommand end # rubocop:enable Metrics/LineLength end