storage manager: make rclone path configurable.
Fix bug where pruning uploads failed because the rclone binary couldn't be found. The upload pruner runs under cron, which has a fixed default $PATH of "/bin:/usr/bin", but in production rclone is installed under /usr/local/bin. This caused the upload pruner to fail, which prevented the rest of daily maintenance from running.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
class StorageManager::Rclone < StorageManager
|
class StorageManager::Rclone < StorageManager
|
||||||
class Error < StandardError; end
|
class Error < StandardError; end
|
||||||
attr_reader :remote, :bucket, :rclone_options
|
attr_reader :remote, :bucket, :rclone_path, :rclone_options
|
||||||
|
|
||||||
def initialize(remote:, bucket:, rclone_options: {}, **options)
|
def initialize(remote:, bucket:, rclone_path: "rclone", rclone_options: {}, **options)
|
||||||
@remote = remote
|
@remote = remote
|
||||||
@bucket = bucket
|
@bucket = bucket
|
||||||
|
@rclone_path = rclone_path
|
||||||
@rclone_options = rclone_options
|
@rclone_options = rclone_options
|
||||||
super(**options)
|
super(**options)
|
||||||
end
|
end
|
||||||
@@ -24,8 +25,8 @@ class StorageManager::Rclone < StorageManager
|
|||||||
end
|
end
|
||||||
|
|
||||||
def rclone(*args)
|
def rclone(*args)
|
||||||
success = system("rclone", *rclone_options, *args)
|
success = system(rclone_path, *rclone_options, *args)
|
||||||
raise Error, "rclone #{$?}" if !success
|
raise Error, "rclone #{args.join(" ")}: #{$?}" if !success
|
||||||
end
|
end
|
||||||
|
|
||||||
def key(path)
|
def key(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user