secret_store: drop update_check and generate_hash as abstract methods #863
@ -23,13 +23,8 @@ class SecretStoreBase(ABC):
|
||||
def exists(self, service: str, name: str) -> bool:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def generate_hash(self) -> bytes:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def update_check(self) -> bool:
|
||||
pass
|
||||
return False
|
||||
|
||||
@abstractmethod
|
||||
def upload(self, output_dir: Path) -> None:
|
||||
|
@ -88,6 +88,8 @@ class SecretStore(SecretStoreBase):
|
||||
hashes.sort()
|
||||
return b"\n".join(hashes)
|
||||
|
||||
# FIXME: add this when we switch to python3.12
|
||||
# @override
|
||||
def update_check(self) -> bool:
|
||||
local_hash = self.generate_hash()
|
||||
remote_hash = self.machine.target_host.run(
|
||||
|
@ -6,8 +6,10 @@ from clan_cli.secrets.machines import add_machine, has_machine
|
||||
from clan_cli.secrets.secrets import decrypt_secret, encrypt_secret, has_secret
|
||||
from clan_cli.secrets.sops import generate_private_key
|
||||
|
||||
from . import SecretStoreBase
|
||||
|
||||
class SecretStore:
|
||||
|
||||
class SecretStore(SecretStoreBase):
|
||||
def __init__(self, machine: Machine) -> None:
|
||||
self.machine = machine
|
||||
|
||||
@ -52,9 +54,6 @@ class SecretStore:
|
||||
f"{self.machine.name}-{name}",
|
||||
)
|
||||
|
||||
def update_check(self) -> bool:
|
||||
return False
|
||||
|
||||
def upload(self, output_dir: Path) -> None:
|
||||
key_name = f"{self.machine.name}-age.key"
|
||||
if not has_secret(self.machine.flake_dir, key_name):
|
||||
|
@ -29,9 +29,6 @@ class SecretStore(SecretStoreBase):
|
||||
def exists(self, service: str, name: str) -> bool:
|
||||
return (self.dir / service / name).exists()
|
||||
|
||||
def update_check(self) -> bool:
|
||||
return False
|
||||
|
||||
def upload(self, output_dir: Path) -> None:
|
||||
if os.path.exists(output_dir):
|
||||
shutil.rmtree(output_dir)
|
||||
|
Loading…
Reference in New Issue
Block a user