|
@@ -3,6 +3,7 @@ from pathlib import Path
|
|
|
from dataclasses import dataclass
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
from pc_backup.keepass import KeePass
|
|
from pc_backup.keepass import KeePass
|
|
|
|
|
+from pc_backup.podman import Podman
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
@dataclass
|
|
@@ -41,9 +42,8 @@ class SecretKeepassAttachment(Secret):
|
|
|
|
|
|
|
|
def create(self, keepass: KeePass):
|
|
def create(self, keepass: KeePass):
|
|
|
value = keepass.read_entry_attachment(self.key, self.attachment)
|
|
value = keepass.read_entry_attachment(self.key, self.attachment)
|
|
|
- args = ["podman", "secret", "create", "--replace", self.name, "-"]
|
|
|
|
|
- print(args)
|
|
|
|
|
- subprocess.run(args, input=value.encode())
|
|
|
|
|
|
|
+ args = ["--replace", self.name, "-"]
|
|
|
|
|
+ Podman.secret_create(args, input=value.encode())
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def from_line(cls, name: str, key: str, attachment: str):
|
|
def from_line(cls, name: str, key: str, attachment: str):
|
|
@@ -57,9 +57,8 @@ class SecretKeepassAttribute(Secret):
|
|
|
|
|
|
|
|
def create(self, keepass: KeePass):
|
|
def create(self, keepass: KeePass):
|
|
|
value = keepass.read_entry_attribute(self.key, self.attribute)
|
|
value = keepass.read_entry_attribute(self.key, self.attribute)
|
|
|
- args = ["podman", "secret", "create", "--replace", self.name, "-"]
|
|
|
|
|
- print(args)
|
|
|
|
|
- subprocess.run(args, input=value.encode())
|
|
|
|
|
|
|
+ args = ["--replace", self.name, "-"]
|
|
|
|
|
+ Podman.secret_create(args, input=value.encode())
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def from_line(cls, name: str, key: str, attribute: str):
|
|
def from_line(cls, name: str, key: str, attribute: str):
|
|
@@ -71,9 +70,8 @@ class SecretFile(Secret):
|
|
|
host_path: Path
|
|
host_path: Path
|
|
|
|
|
|
|
|
def create(self, keepass: KeePass):
|
|
def create(self, keepass: KeePass):
|
|
|
- args = ["podman", "secret", "create", "--replace", self.name, self.host_path]
|
|
|
|
|
- print(args)
|
|
|
|
|
- subprocess.run(args)
|
|
|
|
|
|
|
+ args = ["--replace", self.name, self.host_path]
|
|
|
|
|
+ Podman.secret_create(args)
|
|
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
|
def from_line(cls, name: str, path: str):
|
|
def from_line(cls, name: str, path: str):
|