Skip to content

Commit

Permalink
drop --include-db-dumps parameter, we always include them now
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Jul 19, 2024
1 parent 7fc550d commit 37ec525
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
11 changes: 4 additions & 7 deletions definitions/procedures/backup/online/safety_confirmation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ class SafetyConfirmation < ForemanMaintain::Procedure
metadata do
description 'Data consistency warning'
tags :backup
param :include_db_dumps, 'Are database dumps included in backup', :flag => true,
:default => false
end

def run
answer = ask_decision(warning_message(@include_db_dumps), actions_msg: 'y(yes), q(quit)')
answer = ask_decision(warning_message, actions_msg: 'y(yes), q(quit)')
abort! unless answer == :yes
end

def warning_message(include_db_dumps)
substr = include_db_dumps ? 'database dump' : 'online backup'
"*** WARNING: The #{substr} is intended for making a copy of the data\n" \
def warning_message
"*** WARNING: The online backup is intended for making a copy of the data\n" \
'*** for debugging purposes only.' \
" The backup routine can not ensure 100% consistency while the\n" \
"*** backup is taking place as there is a chance there may be data mismatch between\n" \
'*** the databases while the services are live.' \
" If you wish to utilize the #{substr}\n" \
" If you wish to utilize the online backup\n" \
'*** for production use you need to ensure that there are' \
" no modifications occurring during\n" \
"*** your backup run.\n\nDo you want to proceed?"
Expand Down
22 changes: 1 addition & 21 deletions definitions/scenarios/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Backup < ForemanMaintain::Scenario
param :strategy, 'Backup strategy. One of [:online, :offline]',
:required => true
param :backup_dir, 'Directory where to backup to', :required => true
param :include_db_dumps, 'Include dumps of local dbs as part of offline'
param :preserve_dir, 'Directory where to backup to'
param :incremental_dir, 'Changes since specified backup only'
param :proxy_features, 'List of proxy features to backup (default: all)', :array => true
Expand Down Expand Up @@ -62,15 +61,13 @@ def set_context_mapping
Procedures::Backup::Pulp => :skip)
context.map(:tar_volume_size,
Procedures::Backup::Pulp => :tar_volume_size)
context.map(:include_db_dumps,
Procedures::Backup::Online::SafetyConfirmation => :include_db_dumps)
end
# rubocop:enable Metrics/MethodLength

private

def safety_confirmation
if strategy == :online || include_db_dumps?
if strategy == :online
add_step_with_context(Procedures::Backup::Online::SafetyConfirmation)
end
end
Expand All @@ -82,7 +79,6 @@ def check_valid_strategy
end

def add_offline_backup_steps
include_dumps if include_db_dumps?
add_step_with_context(Procedures::ForemanProxy::Features, :load_only => true)
add_steps_with_context(
Procedures::Service::Stop,
Expand All @@ -102,18 +98,6 @@ def add_offline_backup_steps
)
end

def include_dumps
if feature(:instance).database_local?(:candlepin_database)
add_step_with_context(Procedures::Backup::Online::CandlepinDB)
end
if feature(:instance).database_local?(:foreman_database)
add_step_with_context(Procedures::Backup::Online::ForemanDB)
end
if feature(:instance).database_local?(:pulpcore_database)
add_step_with_context(Procedures::Backup::Online::PulpcoreDB)
end
end

def add_online_backup_steps
add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true,
:online_backup => true)
Expand All @@ -128,10 +112,6 @@ def add_online_backup_steps
def strategy
context.get(:strategy)
end

def include_db_dumps?
!!context.get(:include_db_dumps)
end
end

class BackupRescueCleanup < ForemanMaintain::Scenario
Expand Down
4 changes: 1 addition & 3 deletions lib/foreman_maintain/cli/backup_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ class OfflineBackupCommand < Base
include BackupCommon
interactive_option
common_backup_options
option '--include-db-dumps', :flag, 'Also dump full database schema before offline backup'

def execute
perform_backup(:offline,
:include_db_dumps => include_db_dumps?)
perform_backup(:offline)
end
end

Expand Down

0 comments on commit 37ec525

Please sign in to comment.