Skip to content

Commit

Permalink
Fixes #26017 - treat tar response code 1 as success on online backup
Browse files Browse the repository at this point in the history
During online backup, tar packages files changing on the fly.
It returns 1 if detecting so, while this is not a fatal error
for the backup. Therefore we should treat response code 1 as
success.

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
  • Loading branch information
pmoravec committed May 17, 2019
1 parent 331cfe5 commit 9666c8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion definitions/procedures/backup/config_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ class ConfigFiles < ForemanMaintain::Procedure
param :backup_dir, 'Directory where to backup to', :required => true
param :proxy_features, 'List of proxy features to backup (default: all)',
:array => true, :default => ['all']
param :ignore_changed_files, 'Should packing tar ignore changed files',
:flag => true, :default => false
end

def run
tarball = File.join(@backup_dir, 'config_files.tar.gz')
increments = File.join(@backup_dir, '.config.snar')
with_spinner('Collecting config files to backup') do
configs = config_files.join(' ')
statuses = if @ignore_changed_files then [0, 1] else [0] end
execute!("tar --selinux --create --gzip --file=#{tarball} " \
"--listed-incremental=#{increments} --ignore-failed-read " \
"#{configs}")
"#{configs}", :valid_exit_statuses => statuses)
end
end

Expand Down
2 changes: 1 addition & 1 deletion definitions/scenarios/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def add_snapshot_backup_steps
# rubocop:enable Metrics/MethodLength

def add_online_backup_steps
add_step_with_context(Procedures::Backup::ConfigFiles)
add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true)
add_step_with_context(Procedures::Backup::Pulp, :ensure_unchanged => true)
add_steps_with_context(
Procedures::Backup::Online::Mongo,
Expand Down

0 comments on commit 9666c8e

Please sign in to comment.