From 56d787a17f2f4496d53b0701919d03e205d7df9d Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 27 Dec 2019 17:13:15 -0600 Subject: [PATCH] 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. --- app/logical/storage_manager/rclone.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/logical/storage_manager/rclone.rb b/app/logical/storage_manager/rclone.rb index 9e3cfb5f2..218c3e413 100644 --- a/app/logical/storage_manager/rclone.rb +++ b/app/logical/storage_manager/rclone.rb @@ -1,10 +1,11 @@ class StorageManager::Rclone < StorageManager 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 @bucket = bucket + @rclone_path = rclone_path @rclone_options = rclone_options super(**options) end @@ -24,8 +25,8 @@ class StorageManager::Rclone < StorageManager end def rclone(*args) - success = system("rclone", *rclone_options, *args) - raise Error, "rclone #{$?}" if !success + success = system(rclone_path, *rclone_options, *args) + raise Error, "rclone #{args.join(" ")}: #{$?}" if !success end def key(path)