leapp/SOURCES/0003-Handle-case-when-db-directory-is-missing.patch
2025-05-15 07:15:26 +00:00

31 lines
945 B
Diff

From 4c805dd449c39c1ff00cea4563cc8227ff23a5ec Mon Sep 17 00:00:00 2001
From: karolinku <kkula@redhat.com>
Date: Tue, 1 Apr 2025 16:01:08 +0200
Subject: [PATCH 3/7] Handle case when db directory is missing
When directory is missing, this change will introduce creation of
missing path and allow proceeding with execution.
JIRA: RHEL-54382
---
leapp/utils/audit/__init__.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/leapp/utils/audit/__init__.py b/leapp/utils/audit/__init__.py
index 8511179..d5ebb73 100644
--- a/leapp/utils/audit/__init__.py
+++ b/leapp/utils/audit/__init__.py
@@ -57,6 +57,9 @@ def create_connection(path):
:param path: Path to the database
:return: Connection object
"""
+ db_dir_path = os.path.dirname(path)
+ if not os.path.exists(db_dir_path):
+ os.mkdir(db_dir_path, mode=0o700)
with _umask(0o177):
return _initialize_database(sqlite3.connect(path))
--
2.49.0