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
#generation, #modified, #tag
Instance Method Summary
collapse
Methods inherited from Task
#common_options, #execute, #format, #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, stale, #touch
Methods included from Logging
log, #log
Instance Method Details
#create(*args, process: nil, **opts) ⇒ Object
1196
1197
1198
1199
|
# File 'lib/bitferry.rb', line 1196
def create(*args, process: nil, **opts)
super(*args, **opts)
@process_options = Bitferry.optional(process, PROCESS)
end
|
#externalize ⇒ Object
1211
1212
1213
1214
1215
1216
1217
1218
1219
|
# File 'lib/bitferry.rb', line 1211
def externalize
restic = {
process: process_options
}.compact
super.merge({
operation: :restore,
restic: restic.empty? ? nil : restic
}.compact)
end
|
#process ⇒ Object
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
|
# File 'lib/bitferry.rb', line 1229
def process
log.info("processing task #{tag}")
begin
execute('restore', 'latest', '--target', '.', *process_options, *common_options, simulate: Bitferry.simulate?, chdir: directory.root)
true
rescue
false
end
end
|
#restore(hash) ⇒ Object
1222
1223
1224
1225
1226
|
# File 'lib/bitferry.rb', line 1222
def restore(hash)
super
opts = hash.fetch(:rclone, {})
@process_options = opts[:process]
end
|
#show_direction ⇒ Object
1208
|
# File 'lib/bitferry.rb', line 1208
def show_direction = '-->'
|
#show_operation ⇒ Object
1205
|
# File 'lib/bitferry.rb', line 1205
def show_operation = 'decrypt+restore'
|
#show_status ⇒ Object
1202
|
# File 'lib/bitferry.rb', line 1202
def show_status = "#{show_operation} #{repository.show_status} #{show_direction} #{directory.show_status}"
|