pcs/bz2026725-01-booth-sync-check-whether-etc-booth-exists.patch
Miroslav Lisik c06ed2a4ad Resolves: rhbz#2026725 rhbz#2058243
- Fixed booth ticket mode value case insensitive
- Fixed booth sync check whether /etc/booth exists
2022-07-28 15:43:31 +02:00

47 lines
1.4 KiB
Diff

From f863c38497eb716141c9e585ddb418191e9fc2a4 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Fri, 15 Jul 2022 15:55:57 +0200
Subject: [PATCH 3/3] 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 854674eb..144d25f3 100644
--- a/pcsd/remote.rb
+++ b/pcsd/remote.rb
@@ -2090,6 +2090,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