|
|
32281e |
From fc21b98dced2c78f90f917c1a45a28184024d604 Mon Sep 17 00:00:00 2001
|
|
|
32281e |
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Hor=C3=A1=C4=8Dek?=
|
|
|
32281e |
<shoracek@redhat.com>
|
|
|
32281e |
Date: Tue, 6 Sep 2022 16:54:33 +0200
|
|
|
32281e |
Subject: [PATCH 1/6] Backup with sqlite3 special command
|
|
|
32281e |
MIME-Version: 1.0
|
|
|
32281e |
Content-Type: text/plain; charset=UTF-8
|
|
|
32281e |
Content-Transfer-Encoding: 8bit
|
|
|
32281e |
|
|
|
32281e |
Upstream uses method introduced in Python 3.7, but RHEL 8 uses
|
|
|
32281e |
Python 3.6. This means that the method is not available and using the
|
|
|
32281e |
command line interface seems to be the simplest solution.
|
|
|
32281e |
|
|
|
32281e |
Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
|
|
|
32281e |
---
|
|
|
32281e |
tools/tpm2_pkcs11/db.py | 3 ++-
|
|
|
32281e |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
32281e |
|
|
|
32281e |
diff --git a/tools/tpm2_pkcs11/db.py b/tools/tpm2_pkcs11/db.py
|
|
|
32281e |
index 7971028..1b18b8f 100644
|
|
|
32281e |
--- a/tools/tpm2_pkcs11/db.py
|
|
|
32281e |
+++ b/tools/tpm2_pkcs11/db.py
|
|
|
32281e |
@@ -6,6 +6,7 @@ import sys
|
|
|
32281e |
import sqlite3
|
|
|
32281e |
import textwrap
|
|
|
32281e |
import yaml
|
|
|
32281e |
+import subprocess
|
|
|
32281e |
|
|
|
32281e |
from .pkcs11t import (
|
|
|
32281e |
CKA_ALLOWED_MECHANISMS,
|
|
|
32281e |
@@ -258,8 +259,8 @@ class Db(object):
|
|
|
32281e |
if os.path.exists(dbpath):
|
|
|
32281e |
raise RuntimeError("Backup DB exists at {} not overwriting. "
|
|
|
32281e |
"Refusing to run".format(dbpath))
|
|
|
32281e |
+ subprocess.run(["sqlite3", self._path, ".backup {}".format(dbpath)])
|
|
|
32281e |
bck = sqlite3.connect(dbpath)
|
|
|
32281e |
- con.backup(bck)
|
|
|
32281e |
return (bck, dbpath)
|
|
|
32281e |
|
|
|
32281e |
def _update_on_2(self, dbbakcon):
|
|
|
32281e |
--
|
|
|
32281e |
2.38.1
|
|
|
32281e |
|