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

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