Verified Commit dc6b9614 authored by Jakob Moser's avatar Jakob Moser
Browse files

Use non-changing name for Vault

Closes #23
parent f6ee6269
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ from os import getgid, getuid
from pathlib import Path
from subprocess import CalledProcessError, run
from typing import Any, Self
from uuid import uuid4


@dataclass(frozen=True)
@@ -12,9 +11,13 @@ class Vault(AbstractContextManager):
    image: Path
    mountpoint: Path

    # The name is not part of the interface, but we need to remember it during command execution, because it will be
    # identified by the operating system using this name
    _name: str = f"poolpay-vault-{uuid4()}"
    @property
    def _name(self) -> str:
        """
        Return the name the operating system shall use to identify this vault.
        """
        distinguisher = str(self.image.resolve()).replace("/", "-")
        return f"poolpay-vault-{distinguisher}"

    @property
    def _mapper(self) -> Path: