Commit 480f737e authored by James Fargher's avatar James Fargher

Allow restore tasks to be skipped using SKIP

Previously the only tasks skipped on restore were stored in the backup
manifest. This allows the manifest to be overridden using environment
variables.

Changelog: added
parent 6ecd8a55
......@@ -389,7 +389,8 @@ module Backup
end
def skipped?(item)
backup_information[:skipped] && backup_information[:skipped].include?(item)
ENV.fetch('SKIP', '').include?(item) ||
backup_information[:skipped] && backup_information[:skipped].include?(item)
end
def enabled_task?(task_name)
......
......@@ -228,6 +228,20 @@ RSpec.describe Backup::Manager do
end
end
context 'when SKIP env is set' do
let(:expected_backup_contents) { %w{backup_information.yml task1.tar.gz} }
before do
stub_env('SKIP', 'task2')
end
it 'executes tar' do
subject.create # rubocop:disable Rails/SaveBang
expect(Kernel).to have_received(:system).with(*tar_cmdline)
end
end
context 'when the destination is optional' do
let(:expected_backup_contents) { %w{backup_information.yml task1.tar.gz} }
let(:definitions) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment