Blame SOURCES/bz2026725-01-booth-sync-check-whether-etc-booth-exists.patch

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