make machine class now a dataclass

This commit is contained in:
Jörg Thalheim
2024-07-02 14:06:31 +02:00
parent cc3f99bfaa
commit 2f1dac6962
23 changed files with 125 additions and 128 deletions

View File

@@ -6,6 +6,7 @@ from cli import Cli
from fixtures_flakes import FlakeForTest
from validator import is_valid_age_key, is_valid_ssh_key
from clan_cli.clan_uri import FlakeId
from clan_cli.facts.secret_modules.sops import SecretStore
from clan_cli.machines.facts import machine_get_fact
from clan_cli.machines.machines import Machine
@@ -48,7 +49,7 @@ def test_generate_secret(
)
cmd = ["facts", "generate", "--flake", str(test_flake_with_core.path), "vm1"]
cli.run(cmd)
store1 = SecretStore(Machine(name="vm1", flake=test_flake_with_core.path))
store1 = SecretStore(Machine(name="vm1", flake=FlakeId(test_flake_with_core.path)))
assert store1.exists("", "age.key")
assert store1.exists("", "zerotier-identity-secret")
@@ -76,7 +77,7 @@ def test_generate_secret(
secrets_folder / "vm1-zerotier-identity-secret" / "machines" / "vm1"
).exists()
store2 = SecretStore(Machine(name="vm2", flake=test_flake_with_core.path))
store2 = SecretStore(Machine(name="vm2", flake=FlakeId(test_flake_with_core.path)))
assert store2.exists("", "password")
assert store2.exists("", "password-hash")