Merge pull request 'secret_store: drop update_check and generate_hash as abstract methods' (#863) from Mic92-target_host into main
checks-impure / test (push) Successful in 1m55s Details
checks / test (push) Successful in 2m42s Details

This commit is contained in:
clan-bot 2024-02-20 18:01:51 +00:00
commit ff3a1dc928
4 changed files with 23 additions and 13 deletions

View File

@ -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(

View File

@ -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):

View File

@ -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)

View File

@ -1,3 +1,4 @@
import os
import random
from dataclasses import dataclass
from pathlib import Path
@ -24,9 +25,9 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
return GraphicOptions([
*common,
"-nographic",
"-vga", "none",
"-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
#"-device", "virtio-vga-gl,blob=true",
@ -38,13 +39,24 @@ def graphics_options(vm: VmConfig) -> GraphicOptions:
], cid)
# fmt: on
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
return GraphicOptions([
*common,
"-vga", "none",
"-display", "gtk,gl=on",
"-device", "virtio-gpu-gl",
"-display", "spice-app,gl=on",
*display_options,
"-device", "virtio-serial-pci",
"-chardev", "spicevmc,id=vdagent0,name=vdagent",
"-device", "virtserialport,chardev=vdagent0,name=com.redhat.spice.0",