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

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