From 7e44b3cd51a3a5079d0d42d91a3445f3b8ae9d17 Mon Sep 17 00:00:00 2001 From: Tomas Jelinek Date: Fri, 15 Jul 2022 15:55:57 +0200 Subject: [PATCH 3/4] booth sync: check whether /etc/booth exists --- pcsd/pcsd_file.rb | 6 +----- pcsd/remote.rb | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pcsd/pcsd_file.rb b/pcsd/pcsd_file.rb index d82b55d2..394db59a 100644 --- a/pcsd/pcsd_file.rb +++ b/pcsd/pcsd_file.rb @@ -112,12 +112,8 @@ module PcsdFile end end - def dir() - return BOOTH_CONFIG_DIR - end - def full_file_name() - @full_file_name ||= File.join(self.dir, @file[:name]) + @full_file_name ||= File.join(BOOTH_CONFIG_DIR, @file[:name]) end end diff --git a/pcsd/remote.rb b/pcsd/remote.rb index 9bf96db9..b7bee7e6 100644 --- a/pcsd/remote.rb +++ b/pcsd/remote.rb @@ -2622,6 +2622,10 @@ def booth_set_config(params, request, auth_user) check_permissions(auth_user, Permissions::WRITE) data = check_request_data_for_json(params, auth_user) + if not File.directory?(BOOTH_CONFIG_DIR) + raise "Configuration directory for booth '/etc/booth' is missing. Is booth installed?" + end + PcsdExchangeFormat::validate_item_map_is_Hash('files', data) PcsdExchangeFormat::validate_item_is_Hash('file', :config, data[:config]) if data[:authfile] -- 2.35.3