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:
|
def exists(self, service: str, name: str) -> bool:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def generate_hash(self) -> bytes:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def update_check(self) -> bool:
|
def update_check(self) -> bool:
|
||||||
pass
|
return False
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def upload(self, output_dir: Path) -> None:
|
def upload(self, output_dir: Path) -> None:
|
||||||
|
@ -88,6 +88,8 @@ class SecretStore(SecretStoreBase):
|
|||||||
hashes.sort()
|
hashes.sort()
|
||||||
return b"\n".join(hashes)
|
return b"\n".join(hashes)
|
||||||
|
|
||||||
|
# FIXME: add this when we switch to python3.12
|
||||||
|
# @override
|
||||||
def update_check(self) -> bool:
|
def update_check(self) -> bool:
|
||||||
local_hash = self.generate_hash()
|
local_hash = self.generate_hash()
|
||||||
remote_hash = self.machine.target_host.run(
|
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.secrets import decrypt_secret, encrypt_secret, has_secret
|
||||||
from clan_cli.secrets.sops import generate_private_key
|
from clan_cli.secrets.sops import generate_private_key
|
||||||
|
|
||||||
|
from . import SecretStoreBase
|
||||||
|
|
||||||
class SecretStore:
|
|
||||||
|
class SecretStore(SecretStoreBase):
|
||||||
def __init__(self, machine: Machine) -> None:
|
def __init__(self, machine: Machine) -> None:
|
||||||
self.machine = machine
|
self.machine = machine
|
||||||
|
|
||||||
@ -52,9 +54,6 @@ class SecretStore:
|
|||||||
f"{self.machine.name}-{name}",
|
f"{self.machine.name}-{name}",
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_check(self) -> bool:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def upload(self, output_dir: Path) -> None:
|
def upload(self, output_dir: Path) -> None:
|
||||||
key_name = f"{self.machine.name}-age.key"
|
key_name = f"{self.machine.name}-age.key"
|
||||||
if not has_secret(self.machine.flake_dir, key_name):
|
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:
|
def exists(self, service: str, name: str) -> bool:
|
||||||
return (self.dir / service / name).exists()
|
return (self.dir / service / name).exists()
|
||||||
|
|
||||||
def update_check(self) -> bool:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def upload(self, output_dir: Path) -> None:
|
def upload(self, output_dir: Path) -> None:
|
||||||
if os.path.exists(output_dir):
|
if os.path.exists(output_dir):
|
||||||
shutil.rmtree(output_dir)
|
shutil.rmtree(output_dir)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import random
|
import random
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -24,9 +25,9 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
|
|||||||
return GraphicOptions([
|
return GraphicOptions([
|
||||||
*common,
|
*common,
|
||||||
"-nographic",
|
"-nographic",
|
||||||
"-vga", "none",
|
|
||||||
"-device", f"vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid={cid}",
|
"-device", f"vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid={cid}",
|
||||||
"-display", "egl-headless,gl=core",
|
"-vga", "none",
|
||||||
|
#"-display", "egl-headless,gl=core",
|
||||||
|
|
||||||
# this would make the gpu part of the hypervisor
|
# this would make the gpu part of the hypervisor
|
||||||
#"-device", "virtio-vga-gl,blob=true",
|
#"-device", "virtio-vga-gl,blob=true",
|
||||||
@ -38,13 +39,24 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
|
|||||||
], cid)
|
], cid)
|
||||||
# fmt: on
|
# fmt: on
|
||||||
else:
|
else:
|
||||||
|
if not os.path.exists("/run/opengl-driver"):
|
||||||
|
display_options = [
|
||||||
|
"-vga",
|
||||||
|
"none",
|
||||||
|
"-display",
|
||||||
|
"gtk,gl=on",
|
||||||
|
"-device",
|
||||||
|
"virtio-gpu-gl",
|
||||||
|
"-display",
|
||||||
|
"spice-app,gl=on",
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
display_options = ["-display", "spice-app"]
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
return GraphicOptions([
|
return GraphicOptions([
|
||||||
*common,
|
*common,
|
||||||
"-vga", "none",
|
*display_options,
|
||||||
"-display", "gtk,gl=on",
|
|
||||||
"-device", "virtio-gpu-gl",
|
|
||||||
"-display", "spice-app,gl=on",
|
|
||||||
"-device", "virtio-serial-pci",
|
"-device", "virtio-serial-pci",
|
||||||
"-chardev", "spicevmc,id=vdagent0,name=vdagent",
|
"-chardev", "spicevmc,id=vdagent0,name=vdagent",
|
||||||
"-device", "virtserialport,chardev=vdagent0,name=com.redhat.spice.0",
|
"-device", "virtserialport,chardev=vdagent0,name=com.redhat.spice.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user