Class: Bitferry::Restic::Restore
Constant Summary
collapse
- PROCESS =
{
default: ['--no-cache', '--sparse']
}
Constants inherited
from Task
Task::ROUTE
Instance Attribute Summary
Attributes inherited from Task
#directory, #repository
Attributes inherited from Task
#exclude, #generation, #include, #modified, #tag
Instance Method Summary
collapse
Methods inherited from Task
#common_options, #execute, #format, #include_filters, #initialize, #intact?, #password, #refers?, #touch
Methods inherited from Task
[], #commit, #delete, delete, #initialize, intact, live, #live?, lookup, match, new, #process_options, register, registered, reset, restore, #restore_endpoint, #show_filters, stale, #touch
Methods included from Logging
log, #log, log=
Instance Method Details
#create(*args, process: nil, **opts) ⇒ Object
1318
1319
1320
1321
|
# File 'lib/bitferry.rb', line 1318
def create(*args, process: nil, **opts)
super(*args, **opts)
@process_options = Bitferry.optional(process, PROCESS)
end
|
#exclude_filters ⇒ Object
1324
|
# File 'lib/bitferry.rb', line 1324
def exclude_filters = exclude.collect { |x| ['--exclude', x] }.flatten
|
#externalize ⇒ Object
1340
1341
1342
1343
1344
1345
1346
1347
1348
|
# File 'lib/bitferry.rb', line 1340
def externalize
restic = {
process: process_options
}.compact
super.merge({
operation: :restore,
restic: restic.empty? ? nil : restic
}.compact)
end
|
#process ⇒ Object
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
|
# File 'lib/bitferry.rb', line 1358
def process
log.info("processing task #{tag}")
begin
execute('restore', 'latest', '--target', directory.root.to_s, *include_filters, *exclude_filters, *process_options, *common_options, simulate: Bitferry.simulate?)
true
rescue
false
end
end
|
#restore(hash) ⇒ Object
1351
1352
1353
1354
1355
|
# File 'lib/bitferry.rb', line 1351
def restore(hash)
super
opts = hash.fetch(:rclone, {})
@process_options = opts[:process]
end
|
#show_direction ⇒ Object
1333
|
# File 'lib/bitferry.rb', line 1333
def show_direction = '-->'
|
#show_operation ⇒ Object
1330
|
# File 'lib/bitferry.rb', line 1330
def show_operation = 'decrypt+restore'
|
#show_status ⇒ Object
1327
|
# File 'lib/bitferry.rb', line 1327
def show_status = "#{show_operation} #{repository.show_status} #{show_direction} #{directory.show_status} #{show_filters}"
|